【问题标题】:How does scikit's cross validation work?scikit 的交叉验证是如何工作的?
【发布时间】:2014-09-07 00:09:44
【问题描述】:

我有以下sn-p:

print '\nfitting'
rfr = RandomForestRegressor(
    n_estimators=10,
    max_features='auto',
    criterion='mse',
    max_depth=None,
)
rfr.fit(X_train, y_train)


# scores
scores = cross_val_score(
    estimator=rfr,
    X=X_test,
    y=y_test,
    verbose=1,
    cv=10,
    n_jobs=4,
)
print("Accuracy: %0.2f (+/- %0.2f)" % (scores.mean(), scores.std() * 2))

1) 运行 cross_val_score 是否会对回归器进行更多训练?

2) 我需要传入一个训练有素的回归器还是只是一个新的回归器,例如estimator=RandomForestRegressor()。那么如何测试回归器的准确性,即我必须在 scikit 中使用另一个函数吗?

3) 我的准确率约为 2%。是MSE分数,越低越好,还是实际准确度。如果是实际准确度,您能解释一下吗,因为回归器如何准确预测一个范围是没有意义的。

【问题讨论】:

    标签: python-2.7 scikit-learn random-forest cross-validation


    【解决方案1】:
    1. 实际上它重新训练了估计器,k 次。
    2. 未经训练(或训练,但随后模型被删除,您只是在浪费时间)。
    3. R² score,所以实际上不是2%,而是0.02; R² 上限为 1,但可以为负数。回归的准确性没有明确定义。 (您可以将其定义为分类,但这没有任何意义。)

    【讨论】:

      猜你喜欢
      • 2016-04-25
      • 2017-09-02
      • 2021-10-25
      • 2015-08-06
      • 1970-01-01
      • 2012-01-07
      • 2015-06-22
      • 2017-12-22
      • 1970-01-01
      相关资源
      最近更新 更多