Skip to content

Conversation

@lukaswenzl
Copy link

Starting with version 3.1.0 xgboost changed the default behavior of base_score to be a vector instead of a number:
see https://xgboost.readthedocs.io/en/stable/parameter.html

Changed in version 3.1.0: XGBoost is updated to use vector-valued intercept by default.

This breaks the conversion script to ONNX, and most xgboost tests of this repo fail when using the latest version of xgboost.

This issue was also raised in #732

In this pr I am proposing a fix:

  • add support for reading base_score as a number or a list of numbers
  • If the list contains only one number then convert to a number and proceed as before
  • If there are multiple numbers, this indicates we have a multiclass model with different intercepts for each class. We can store the whole list and map it to base_values, which can already handle distinct intercept values for each class.

With these changes all tests pass again for the latest version of xgboost

@lukaswenzl lukaswenzl changed the title Fix intercept handling of xgboost starting with version 3.1.1 Fix intercept handling of xgboost starting with version 3.1.0 Oct 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant