diff --git a/python/treelite/sklearn/importer.py b/python/treelite/sklearn/importer.py index f198078a..02270375 100644 --- a/python/treelite/sklearn/importer.py +++ b/python/treelite/sklearn/importer.py @@ -67,9 +67,17 @@ def import_model(sklearn_model): ---- For :py:class:`~sklearn.ensemble.IsolationForest`, the loaded model will calculate the outlier score using the standardized ratio as proposed in the original reference, - which matches with :py:meth:`~sklearn.ensemble.IsolationForest._compute_chunked_score_samples` + which matches with :py:meth:`~sklearn.ensemble.IsolationForest.score_samples` but is a bit different from :py:meth:`~sklearn.ensemble.IsolationForest.decision_function`. + More precisely, the following relation holds: + + .. code-block:: python + + treelite.gtil.predict(tl_model, X) == -clf.score_samples(X) + # clf is an IsolationForest + # tl_model is a Treelite representation of clf + Parameters ---------- sklearn_model : object of type \ diff --git a/tests/python/test_sklearn_integration.py b/tests/python/test_sklearn_integration.py index 67ff13ea..4b6f8436 100644 --- a/tests/python/test_sklearn_integration.py +++ b/tests/python/test_sklearn_integration.py @@ -187,7 +187,7 @@ def test_skl_converter_iforest(dataset): random_state=0, ) clf.fit(X) - expected_pred = clf._compute_chunked_score_samples(X) # pylint: disable=W0212 + expected_pred = -clf.score_samples(X) expected_pred = expected_pred.reshape((-1, 1, 1)) tl_model = treelite.sklearn.import_model(clf)