Xgboost调参总结
Posted nxf-rabbit75
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Xgboost调参总结相关的知识,希望对你有一定的参考价值。
1. 回归
from xgboost.sklearn import XGBRegressor from sklearn.model_selection import ShuffleSplit import xgboost as xgb xgb_model_ = XGBRegressor(n_thread=8) cv_split = ShuffleSplit(n_splits = 6,train_size=0.7,test_size=0.2) xgb_params={‘max_depth‘:[4,5,6,7], ‘learning_rate‘:np.linspace(0.03,0.3,10), ‘n_estimators‘:[100,200]} xgb_search = GridSearchCV(xgb_model_, param_grid=xgb_params, scoring=‘r2‘, iid=False, cv=5) xgb_search.fit(gbdt_train_data,gbdt_train_label) print(xgb_search.grid_scores_) print(xgb_search.best_params_) print(xgb_search.best_score_)
2. 分类
以上是关于Xgboost调参总结的主要内容,如果未能解决你的问题,请参考以下文章