Skip to content

Commit 680de9c

Browse files
authored
Fixes #457, use all tree when best_ntree_limit is not specified (#459)
* Test onnxmltools against Python3.8 * Fix #457, issue with empty tree
1 parent fd044d7 commit 680de9c

File tree

3 files changed

+69
-1
lines changed

3 files changed

+69
-1
lines changed

onnxmltools/convert/xgboost/operator_converters/XGBoost.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def convert(scope, operator, container):
230230

231231
bst = xgb_node.get_booster()
232232
best_ntree_limit = getattr(bst, 'best_ntree_limit', len(js_trees)) * ncl
233-
if best_ntree_limit < len(js_trees):
233+
if 0 < best_ntree_limit < len(js_trees):
234234
js_trees = js_trees[:best_ntree_limit]
235235
attr_pairs = XGBClassifierConverter._get_default_tree_attribute_pairs()
236236
XGBConverter.fill_tree_attributes(js_trees, attr_pairs, [1 for _ in js_trees], True)

0 commit comments

Comments
 (0)