小编cbu*_*tem的帖子

如何从 xgboost CV 中获取经过训练的模型?

我正在运行以下代码:

params = {"objective":"reg:squarederror",'colsample_bytree': 0.3,'learning_rate': 0.15,
                'max_depth': 5, 'alpha': 15}

data_dmatrix = xgb.DMatrix(data=X_train,label=y_train)
cv_results = xgb.cv(dtrain=data_dmatrix, params=params, nfold=3,
                    num_boost_round=50, early_stopping_rounds=10, 
                    metrics="rmse", as_pandas=True, seed=0)
Run Code Online (Sandbox Code Playgroud)

结果看起来很棒,我想用我保留的数据来测试交叉验证的最佳模型。但是我怎样才能得到模型呢?

python xgboost

3
推荐指数
2
解决办法
4178
查看次数

标签 统计

python ×1

xgboost ×1