gators.model_building.LGBMTreeliteDumper¶
-
class
gators.model_building.
LGBMTreeliteDumper
[source]¶ LightGBM Treelite Dumper class.
Examples
>>> import numpy as np >>> from lightgbm import LGBMClassifier >>> from gators.model_building import LGBMTreeliteDumper >>> X_train = np.array([[0, 0], [0, 1], [1, 0], [1, 1]]) >>> y_train = np.array([0, 1, 1, 0]) >>> model = LGBMClassifier(max_depth=1, n_estimators=1).fit(X_train, y_train) >>> LGBMTreeliteDumper.dump( ... model=model, ... toolchain='gcc', ... parallel_comp=1, ... model_path='.', ... model_name='dummy') [00:00:00] /Users/travis/build/dmlc/treelite/src/compiler/ast/split.cc:29: Parallel compilation enabled; member trees will be divided into 1 translation units. [00:00:01] /Users/travis/build/dmlc/treelite/src/compiler/ast/split.cc:29: Parallel compilation enabled; member trees will be divided into 1 translation units.
-
static
dump
(model: Union[lightgbm.sklearn.LGBMClassifier, lightgbm.sklearn.LGBMRegressor], toolchain: str, parallel_comp: int, model_path: str, model_name: str, verbose: bool = False)[source]¶ Dump the XGBoost treelite as a .so and a .dylib file.
- Parameters
- model: Union[LGBMClassifier, LGBMRegressor].
LightGBM trained model.
- toolchain: str
Compiler. List of available treelite compiler. * gcc * clang * msvc
- parallel_comp: int
Treelite parallel compilation.
- model_pathstr
Model path.
- model_namestr
Model name.
- verbose: bool, default False.
Verbosity.
-
static