我正在尝试在GridSearch中设置一个RandomForestClassification
rfc_model = RandomForestClassifier(n_estimators = 5, max_depth = 3 )
gs = grid_search.GridSearchCV(estimator = rfc_model,
param_grid = {'n_estimators': [i for i in range(1,52,10)],
"max_depth": [3, 5],
"bootstrap": [True, False],
"criterion": ["gini"]},
cv = cross_val_score(rfc_model,X, y, scoring='roc_auc'))
gs.fit(X, y)
gs.grid_scores_
print gs.best_estimator
print gs.best_score_
我知道错误了
TypeError: 'numpy.float64' object is not iterable
显然我在学习,所以欢迎发表任何意见。在
好的,我发现了问题,我使用了错误的方法(可以称之为方法吗?)对于交叉验证,在解决方案下方:
相关问题 更多 >
编程相关推荐