Skip to content

Commit

Permalink
Explicitly check for list type
Browse files Browse the repository at this point in the history
  • Loading branch information
hcho3 committed Feb 16, 2024
1 parent e3c0263 commit 7333eb9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/treelite/sklearn/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ def import_model(sklearn_model):
)
elif isinstance(sklearn_model, (RandomForestC, ExtraTreesC)):
# pylint: disable=C3001
try: # multi-target
if isinstance(sklearn_model.n_classes_, list): # multi-target
max_n_classes = max(sklearn_model.n_classes_)
except TypeError: # single-target
else: # single-target
max_n_classes = sklearn_model.n_classes_
leaf_value_expected_shape = lambda node_count: ( # noqa: E731
node_count,
Expand Down

0 comments on commit 7333eb9

Please sign in to comment.