交叉验证python_急!请教一个python里交叉验证的问题

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

我对模型进行交叉验证:

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.

求大神解答!感谢!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值