clf_utils.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:SourceFilterContoursMelody 作者: juanjobosch 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号