def train_clf(x_train, y_train, best_depth):
""" Train classifier.
Parameters
----------
x_train : np.array [n_samples, n_features]
Training features.
y_train : np.array [n_samples]
Training labels
best_depth : int
Optimal max_depth parameter
Returns
-------
clf : classifier
Trained scikit-learn classifier
"""
clf = RFC(n_estimators=100, max_depth=best_depth, n_jobs=-1,
class_weight='auto', max_features=None)
clf = clf.fit(x_train, y_train)
return clf
clf_utils.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录