Python XGBoost多类随机搜索超参数tunning
我正在为我的模型进行超参数调谐,我的代码如下:Python XGBoost多类随机搜索超参数tunning,python,random-forest,xgboost,multilabel-classification,Python,Random Forest,Xgboost,Multilabel Classification,我正在为我的模型进行超参数调谐,我的代码如下: para_tunning = { 'learning_rate': [0.01,0.05,0.1], 'min_child_weight': [1, 5, 10], 'gamma': [0.5, 1, 1.5, 2, 5], 'subsample': [0.6, 0.8, 1.0], 'colsample_bytree': [0.6, 0.8, 1.0],
para_tunning = {
'learning_rate': [0.01,0.05,0.1],
'min_child_weight': [1, 5, 10],
'gamma': [0.5, 1, 1.5, 2, 5],
'subsample': [0.6, 0.8, 1.0],
'colsample_bytree': [0.6, 0.8, 1.0],
'max_depth': [3, 4, 5, 6, 7, 8, 9, 10],
"n_estimators": [100, 200, 300, 400, 500],
"objective": "multi:softmax",
"aplha":[0,2,4,6,8]
}
clf_rndcv = RandomizedSearchCV(clf,
param_distributions = para_tunning,
cv = 5,
n_iter = 5,
scoring = 'accuracy',
error_score = 0,
verbose = 3,
n_jobs = -1,
random_state = 42)
clf_rndcv.fit(X_train, y_train)
它显示,5个候选项中的每一个都有5次拟合,总共25次拟合,我想它只是从para_tunning dict中随机选取5次,然后做5次cv?如果我想测试所有参数,是否切换到gridsearchcv?有什么建议吗?我正在做一个有100个类的多类分类器,每个类500个样本:总共50000个。谢谢 是,如果要搜索所有超参数,必须使用
GridSearchCV
GridSearch
搜索所有可能的超参数组合(根据您的情况,它可能非常大)
仅供参考,XGBoost有自己的超参数调优 是,如果要搜索所有超参数,必须使用
GridSearchCV
GridSearch
搜索所有可能的超参数组合(根据您的情况,它可能非常大)
仅供参考,XGBoost有自己的超参数调优