scikit-learn compatible tools to work with GBM models
Project description
scikit-gbm
scikit-learn compatible tools to work with GBM models
Installation
pip install scikit-gbm
# or
pip install git+https://github.com/krzjoa/scikit-gbm.git
Usage
For the moment, the only available class is GBMFeaturezier
. It's a wrapper around
scikit-learn GBMs, XGBoost, LightGBM and CatBoost models.
# Classification
from sklearn.datasets import make_classification
from sklearn.pipeline import Pipeline
from sklearn.linear_model import LogisticRegression
from skgbm.preprocessing import GBMFeaturizer
from lightgbm import LGBMRegressor
from xgboost import XGBClassifier
X, y = make_classification()
# train_test_split
pipeline = \
Pipeline([
('gbm_featurizer', GBMFeaturizer(XGBClassifier())),
('logistic_regression', LogisticRegression())
])
# Try also:
# ('gbm_featurizer', GBMFeaturizer(GradientBoostingClassifier())),
# ('gbm_featurizer', GBMFeaturizer(LGBMClassifier())),
# ('gbm_featurizer', GBMFeaturizer(CatBoostClassifier())),
# Regression
X, y = load_breast_cancer(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y)
# Try also:
# ('gbm_featurizer', GBMFeaturizer(GradientBoostingClassifier())),
# ('gbm_featurizer', GBMFeaturizer(LGBMClassifier())),
# ('gbm_featurizer', GBMFeaturizer(CatBoostClassifier())),
pipeline = \
Pipeline([
('gbm_featurizer', GBMFeaturizer(XGBClassifier())),
('logistic_regression', LogisticRegression())
])
# Training
pipeline.fit(X_train, y_train)
# Predictions for the test set
pipeline_pred = pipeline.predict(X_test)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
scikit-gbm-0.1.0.tar.gz
(8.5 kB
view hashes)
Built Distribution
scikit_gbm-0.1.0-py3-none-any.whl
(10.2 kB
view hashes)
Close
Hashes for scikit_gbm-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 672096cde4f36e84596212919a535cb563dc9b9c2b677335fb4627e62410f28b |
|
MD5 | cd881a653d28540fceaa6e523844072d |
|
BLAKE2b-256 | 9dcecc3e35fa908a66b3773fda13d11e87a9f8e89e19d29496e0143badd537b9 |