Giter VIP home page Giter VIP logo

hrbm's Introduction

Interpretable Ensembles of Hyper-Rectangles as Base Models (HRBM)

Prerequisites

Please, make sure:

  • Python version is smaller than 3.11 (some dependencies like numba currently are not implemented for >= 3.11);
  • Your CPU is little-endian (only for this format bitset packing is currently implemented and tested. It is required for Data-based SHAP explanation).

How to Use

Usage examples are located in notebooks/, but a brief introduction is provided below.

Model training

Currently two base models are available:

Note that by default these models assume that target variable is scaled to small range (like [-1, 1]). hrbm.wrappers.scaler.ScalerWrapper can be used to wrap a model and automatically transform target values, and rescale them back after prediction.

Example:

from hrbm.wrappers.scaler import ScalerWrapper
from hrbm.boosting.corner import CornerBoosting

model = ScalerWrapper(
    CornerBoosting(
        learning_rate=1.0,
        need_rsm=True,
        rsm_size=5,
        val_size=0.5,
        hold_validation_set=False,
        enable_validation=False,
        reg_type='value',
        l1_reg=0.0,
        l2_reg='auto',
        l1_reg_min=0.0,
        l2_reg_min=0.01,
        n_estimators=10000,
        reg_beta=0.01,
        random_state=12345,
    )
)

model.fit(X_train, y_train)

Explanation

Two explainers are available:

from hrbm.shap.model_based import ModelBasedEnsembleSHAP
from hrbm.shap.data_based import DataBasedEnsembleSHAP

model_explainer = ModelBasedEnsembleSHAP(model.model)
model_values, model_bias = model_explainer(explain_points)

data_explainer = DataBasedEnsembleSHAP(model.model, X_train)
data_values, data_bias = data_explainer(explain_points)

hrbm's People

Contributors

andruekonst avatar

Stargazers

Jeff Carpenter avatar

Watchers

 avatar

Forkers

btknzn

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.