AdaBoost及其基础学习器的GridSearchCV配置



我正在AdaBoost上运行网格搜索,使用DecisionTreeClassifier作为其基础学习器,以获得AdaBoost和DecisionTree的最佳参数。

对数据集(130000, 22)的搜索已经运行了18个小时,所以我想知道这是否只是等待培训的另一个典型的一天,或者可能设置有问题。

基础学习器、网格搜索、训练和参数设置是否正确?

ada_params = {"base_estimator__criterion" : ["gini", "entropy"],
"base_estimator__splitter" :   ["best", "random"],
"base_estimator__min_samples_leaf": [*np.arange(100,1500,100)],
"base_estimator__max_depth": [5,10,13,15],
"base_estimator__max_features": [5,10,15],
"n_estimators": [500, 700, 1000, 1500],
"learning_rate": [0.001, 0.01, 0.1, 0.3]
}
dt_base_learner = DecisionTreeClassifier(random_state = 42, max_features="auto", class_weight = "balanced")
ada_clf = AdaBoostClassifier(base_estimator = dt_base_learner)
ada_search = GridSearchCV(ada_clf, param_grid=ada_params, scoring = 'f1', cv=kf)
ada_search.fit(scaled_X_train, y_train)

如果我没有弄错的话,您的GridSearch测试14 * 4 * 3 * 4 * 4 = 2,688不同的模型配置,每个模型配置用于未知数量的分割的交叉验证。你应该尽量减少GridSearchCV中的组合数量,或者从skopt转向RandomizedSearchCVBayesSearchCV

Gridsearch将不会完成,直到所有连接都完成,检查RandomSearchcv文档并一次增加几个连接(n_iter)并添加"-1"在"n_jobs"尽可能地并行化

https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.RandomizedSearchCV.html

最新更新