BaggingClassifier的超参数 n_estimators=N,max_features=n能够用GridSearchCV搜索吗
来源:13-4 oob (Out-of-Bag) 和关于Bagging的更多讨论
qq_慕姐45445
2021-06-26
from sklearn.ensemble import BaggingClassifier
from sklearn.model_selection import GridSearchCV
bagging_clf = BaggingClassifier(DecisionTreeClassifier()
bootstrap=True, oob_score=True,bootstrap_features=True)
param_grid_bagging = {‘n_estimatorsl’:[100,200,500,1000],
’,max_samples’:[10,20,50,100,200,500,1000],
‘max_features’:[5,10,20,30,40]}
bagging_clf=GridSearchCV(bagging_clf,param_grid_bagging,scoring={‘AUC’:‘roc_auc’},refit=‘AUC’,cv=10)
bagging_clf.fit(x_train1,y_train)
print(bagging_clf.best_estimator_)
我试了一下不行。啊,在那些地方要修改?谢谢老师
写回答
1回答
-
liuyubobobo
2021-06-26
什么叫不行?报了什么错?
022021-06-26
相似问题