该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
我对模型进行交叉验证:
param_test = {'n_estimators':range(10,71,10)}
gsearch1=GridSearchCV(estimator=RandomForestClassifier(min_samples_split=100,
min_samples_leaf=20,max_depth=8,max_features='sqrt',random_state=10),
param_grid=param_test,scoring='roc_auc',cv=5)
出现以下错误:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in () 2 gsearch1=GridSearchCV(estimator=RandomForestClassifier(min_samples_split=100, 3 min_samples_leaf=20,max_depth=8,max_features='sqrt',random_state=10),----> 4 param_grid=param_test,scoring='roc_auc',cv=5) 5 #gsearch1.fit(x_train,y_train) 6 #gsearch1.grid_scores_,gsearch1.best_params_,gsearch1.best_score_D:\AnalystSoftware\Anaconda3-4.3.0\lib\site-packages\sklearn\grid_search.py in __init__(self, estimator, param_grid, scoring, fit_params, n_jobs, iid, refit, cv, verbose, pre_dispatch, error_score) 810 refit, cv, verbose, pre_dispatch, error_score) 811 self.param_grid = param_grid--> 812 _check_param_grid(param_grid) 813 814 def fit(self, X, y=None):D:\AnalystSoftware\Anaconda3-4.3.0\lib\site-packages\sklearn\grid_search.py in _check_param_grid(param_grid) 346 if True not in check: 347 raise ValueError("Parameter values for parameter ({0}) need "--> 348 "to be a sequence.".format(name)) 349 350 if len(v) == 0:ValueError: Parameter values for parameter (n_estimators) need to be a sequence.
求大神解答!感谢!