我用Random Forest对Classification进行Grid-Search时遇到此错误。
from sklearn.ensemble import RandomForestRegressor
rf2 = RandomForestRegressor(random_state = 50)
rf2.fit(X_train1, y_train1)
### Grid Search ###
num_leafs = [1, 5, 10, 20, 50, 100]
parameters3 = [{'n_estimators' : range(100,800,20),
'max_depth': range(1,20,2),
'min_samples_leaf':num_leafs
}]
gs3 = GridSearchCV(estimator=rf2,
param_grid=parameters3,
cv = 10,
n_jobs = -1)
gs3 = rf2.fit(X_train1, y_train1)
gs3.best_params_ # <- thats where I get the Error
我不知道问题,因为它与SVM和决策树的工作方式相同(当然,不同的参数)。>>
提前感谢
我在使用随机森林进行我的分类进行网格搜索时遇到此错误。从sklearn.ensemble导入RandomForestRegressor rf2 = RandomForestRegressor(random_state = 50)rf2.fit(...
替换为:gs3 = rf2.fit(X_train1, y_train1)