Skip to content

Commit 053bd8c

Browse files
Fix for XGBoost model builder (#841) (#878)
(cherry picked from commit 2fcd1f7) Co-authored-by: KalyanovD <[email protected]>
1 parent ad55af6 commit 053bd8c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/gbt_convertors.pyx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ def get_gbt_model_from_xgboost(booster: Any) -> Any:
121121
self.parent_id = parent_id
122122
self.position = position
123123

124+
# Release Note for XGBoost 1.5.0: Python interface now supports configuring
125+
# constraints using feature names instead of feature indices.
126+
if booster.feature_names is None:
127+
lst = [*range(booster.num_features())]
128+
booster.feature_names = [str(i) for i in lst]
129+
124130
trees_arr = booster.get_dump(dump_format="json")
125131
xgb_config = json.loads(booster.save_config())
126132

0 commit comments

Comments
 (0)