main.py 文件源码

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

项目:coursera-machine-learning-yandex 作者: dstarcev 项目源码 文件源码
def calculate(X, y, threshold):
    best_t, best_score = 0, -float('inf')
    kf = KFold(len(y), n_folds=5, random_state=1, shuffle=True)
    for t in xrange(1, 51):
        clf = RandomForestRegressor(n_estimators=t, random_state=1)
        score = np.mean(cross_val_score(clf, X, y, cv=kf, scoring='r2'))
        if score > threshold:
            return t
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号