From 7aaefd59d5a04bee4caebd323f726ac9f46e5a0d Mon Sep 17 00:00:00 2001 From: Hyunsu Cho Date: Tue, 24 Oct 2023 21:31:34 -0700 Subject: [PATCH] [Doc] various fixes --- python/treelite/model.py | 16 ++++++++-------- python/treelite/sklearn/importer.py | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/python/treelite/model.py b/python/treelite/model.py index 0ec723a3..fe958052 100644 --- a/python/treelite/model.py +++ b/python/treelite/model.py @@ -110,8 +110,8 @@ def load( cls, filename: str, model_format: str, allow_unknown_field: bool = False ) -> Model: """ - Deprecated. Please use \ref ~treelite.frontend.load_xgboost_model instead. - Load a tree ensemble model from a file + Deprecated. Please use :py:meth:`~treelite.frontend.load_xgboost_model` instead. + Load a tree ensemble model from a file. Parameters ---------- @@ -157,8 +157,8 @@ def deprecation_warning(alt: str) -> None: @classmethod def from_xgboost(cls, booster: Any) -> Model: """ - Deprecated. Please use \ref ~treelite.frontend.from_xgboost instead. - Load a tree ensemble model from an XGBoost Booster object + Deprecated. Please use :py:meth:`~treelite.frontend.from_xgboost` instead. + Load a tree ensemble model from an XGBoost Booster object. Parameters ---------- @@ -187,8 +187,8 @@ def from_xgboost_json( allow_unknown_field: bool = False, ) -> Model: """ - Deprecated. Please use \ref ~treelite.frontend.from_xgboost_json instead. - Load a tree ensemble model from a string containing XGBoost JSON + Deprecated. Please use :py:meth:`~treelite.frontend.from_xgboost_json` instead. + Load a tree ensemble model from a string containing XGBoost JSON. Parameters ---------- @@ -218,8 +218,8 @@ def from_xgboost_json( @classmethod def from_lightgbm(cls, booster): """ - Deprecated. Please use \ref ~treelite.frontend.from_lightgbm instead. - Load a tree ensemble model from a LightGBM Booster object + Deprecated. Please use :py:meth:`~treelite.frontend.from_lightgbm` instead. + Load a tree ensemble model from a LightGBM Booster object. Parameters ---------- diff --git a/python/treelite/sklearn/importer.py b/python/treelite/sklearn/importer.py index dc612651..1d027fee 100644 --- a/python/treelite/sklearn/importer.py +++ b/python/treelite/sklearn/importer.py @@ -3,7 +3,6 @@ import ctypes import numpy as np -from sklearn.dummy import DummyClassifier, DummyRegressor from ..core import _LIB, TreeliteError, _check_call from ..frontend import Model @@ -109,6 +108,7 @@ def import_model(sklearn_model): test nodes have numerical test conditions. """ try: + from sklearn.dummy import DummyClassifier, DummyRegressor from sklearn.ensemble import ExtraTreesClassifier as ExtraTreesC from sklearn.ensemble import ExtraTreesRegressor as ExtraTreesR from sklearn.ensemble import GradientBoostingClassifier as GradientBoostingC