Scikit learn xgboost“是否;“适合”;是否允许继续培训?

Scikit learn xgboost“是否;“适合”;是否允许继续培训?,scikit-learn,xgboost,Scikit Learn,Xgboost,我想知道我的K-Fold实现是否正确: from sklearn.model_selection import KFold kf = KFold(n_splits=numFolds, shuffle=False, random_state=7) sales_prediction_model = xgb.XGBRegressor( silent=False, learning_rate=0.03,

我想知道我的K-Fold实现是否正确:

from sklearn.model_selection import KFold

kf = KFold(n_splits=numFolds, shuffle=False, random_state=7)
sales_prediction_model = xgb.XGBRegressor(
                    silent=False,
                    learning_rate=0.03,
                    n_estimators=10000,
                    max_depth=4,
                    # sub_sample=0.8,
                    gamma=1,
                    colsample_bytree=0.8,
                    n_jobs=30
                )

for train_index, test_index in kf.split(X_train):
     X_tr, X_te = X_train.iloc[train_index], X_train.iloc[test_index]
     y_tr, y_te = y_train.iloc[train_index], y_train.iloc[test_index]
     eval_set = [(X_tr, y_tr), (X_te, y_te)]
     sales_prediction_model.fit(X_tr, y_tr, verbose=False,
          early_stopping_rounds=15,eval_set=eval_set, eval_metric="mae")
健身功能是继续训练,还是从头开始

谢谢你的帮助


(xgboost文档仅说明:“适合梯度增压模型”)

可能重复的您确定要继续培训吗?在交叉验证中,通常需要在每次迭代中训练一个独立的模型,即“从头开始”可能重复的模型。您确定要继续训练吗?在交叉验证中,人们通常希望在每次迭代中训练一个独立的模型,即“从头开始”