sklearn-fab Reference V1.1.0¶
Overview¶
What is sklearn-fab?¶
sklearn-fab is a scikit-learn-compatible library using the FAB-engine for regression and classification problems.
Features:
follows the scikit-learn API conventions (can fit with numpy or pandas data)
utilizes highly configurable FAB/HME learners for Heterogeneous Mixture Learning applications
fits supervised binary tree models called FAB/HME models
offers a tool to visualize FAB/HME models
To learn more about FAB and the FAB-engine, refer to the FAB Reference.
sklearn-fab v1.1.0 currently supports the following FAB-engine features:
Supported learners:
Single target Bernoulli-gate Linear Regression component Learner (Bern/Rg)
Single target Bernoulli-gate Linear Classification component Learner (Bern/Cl)
Multi target Bernoulli-gate linear Classification component Learner (Bern/MCl)
Supported initialization types:
random start
Quickstart¶
Installation¶
(Optional) Prepare Python3.8 environment
$ sudo yum install -y centos-release-scl-rh
$ sudo yum install -y rh-python38-python rh-python38-python-pip rh-python38-python-devel
$ source /opt/rh/rh-python38/enable
Extract the sklearn-fab-1.1.0.zip file into any directory
$ unzip sklearn-fab-1.1.0.zip
Install the required rpm packages
$ sudo yum install -y sklearn-fab-1.1.0/rpms/*.rpm
Install the required python packages
$ sudo pip install sklearn-fab-1.1.0/whls/*whl
Core Usage Example¶
import logging
from sklearn_fab import SklearnFABBernGateLinearRegressor
from sklearn.datasets import load_boston
# Display progress logs on stdout
logging.basicConfig(level=logging.INFO)
# Initialize estimator instance
rg = SklearnFABBernGateLinearRegressor(tree_depth=3, shrink_threshold=2.0)
# Execute estimator fit()
rg.fit(load_boston().data[:-1], load_boston().target[:-1])
# Execute estimator predict()
rg.predict(load_boston().data[-1:])