0

I want to do Incremental Learning using XGBClassifier. I found xgb_model parameter of XGB can achieve this.

As a 1st Step, I trained XGB Classifier on 1st Data Set. It trained well & Predictions were also made. code is as follows:

from xgboost import XGBClassifier
xgb_model1 = XGBClassifier(objective = 'binary:logistic')
xgb_model1.fit(X_train1, y_train1) # 1st dataset training
# Saving Model_1
xgb_model1.save_model('model_1.model')

As a next step, On trying xgb_model parameter for XGB , some of the trials shows warning for below code snippet.

xgb_model2 = XGBClassifier(objective = 'binary:logistic', xgb_model = 'model_1.model') # Loaded Model_1 using xgb_model parameter
xgb_model2.fit(X_train2, y_train2) # 2nd dataset training

WARNING: C:/Users/Administrator/workspace/xgboost-win64_release_1.3.0/src/learner.cc:541: Parameters: { xgb_model } might not be used.

This may not be accurate due to some parameters are only used in language bindings but passed down to XGBoost core. Or some parameters are not used but slip through this verification. Please open an issue if you find above cases.

[Warning for above code snippet - 2nd time training for Incremental learning]

4

1 回答 1

0

而不是xgb_model在第二步中使用你应该model_in在你的参数中使用代码应该是这样的:

xgb_model2 = XGBClassifier(objective = 'binary:logistic', model_in = 'model_1.model') # Loaded Model_1 using xgb_model parameter
xgb_model2.fit(X_train2, y_train2) # 2nd dataset training
于 2021-05-12T02:49:13.893 回答