Skip to content

Commit

Permalink
Merge branch 'intel:main' into dev/BS_fix_3
Browse files Browse the repository at this point in the history
  • Loading branch information
icfaust authored Sep 20, 2024
2 parents ced4435 + 0b8bec8 commit f179802
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dependencies-dev
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ numpy==2.0.1 ; python_version <= '3.9'
numpy==2.1.1 ; python_version > '3.9'
pybind11==2.13.5
cmake==3.30.3
setuptools==74.1.2
setuptools==75.1.0
11 changes: 11 additions & 0 deletions src/gbt_convertors.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,17 @@ class TreeList(list):
Note: We cannot type-hint the xgb.Booster without loading xgb as dependency in pyx code,
therefore not type hint is added.
"""
# dump_format="json" is affected by the integer-overflow error,
# since XGBoost doesn't control numeric limits of integer features.
# For correct conversion we manulally replace feature types from 'int'->'float;
if hasattr(booster, "feature_types"):
feature_types = booster.feature_types
if feature_types:
for i in range(len(feature_types)):
if feature_types[i] == "int":
feature_types[i] = "float"
booster.feature_types = feature_types

tl = TreeList()
dump = booster.get_dump(dump_format="json", with_stats=True)
for tree_id, raw_tree in enumerate(dump):
Expand Down

0 comments on commit f179802

Please sign in to comment.