Skip to content

Instantly share code, notes, and snippets.

@ylogx
Last active May 25, 2024 22:10
Show Gist options
  • Save ylogx/53fef94cc61d6a3e9b3eb900482f41e0 to your computer and use it in GitHub Desktop.
Save ylogx/53fef94cc61d6a3e9b3eb900482f41e0 to your computer and use it in GitHub Desktop.
XGBoost Incremental Learning
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@marymlucas
Copy link

marymlucas commented Jul 14, 2023

Disregard, I figured it out. I was using handle_unknown='ignore' in OneHotEncoder, but one of the features has too few of a particular category, hence the mismatch.

Thank you for this gist. How can we implement this in a pipeline?

I am unable to test on the Boston dataset as it's been removed from sklearn, but on a different dataset I get a mismatch in number of columns. Even though I use the same pipeline the saved model seems to have one less feature than the new training data and I am unable to figure out why.

@Jason2Brownlee
Copy link

Great example!

Few people know that xgboost is able to perform incremental learning by adding boosting rounds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment