Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Latest commit

 

History

History
33 lines (23 loc) · 1.19 KB

README.md

File metadata and controls

33 lines (23 loc) · 1.19 KB

MAPLE: Model Agnostic suPervised Local Explanations

by Gregory Plumb, Denali Molitor and Ameet S. Talwalkar ([paper] [blog])

How to use

1. Create an ensemble classifier (that has an apply method which returns the leaf indices of the different predictions) and a linear model

from sklearn.linear_model import Ridge
from sklearn.ensemble import RandomForestRegressor
rf = RandomForestRegressor(n_estimators=200, max_features=0.5, min_samples_leaf=10)
lr = Ridge(alpha=0.001)

2. Create the MAPLE object and pass along the ensemble and linear model

from skmaple import MAPLE
maple = MAPLE(rf, lr)

3. Fit and predict

maple.fit(X_train, y_train)
preds = maple.predict(X_test)

Check out skmaple/example.py for an example!

Reproducing accuracy experiments

In order to compare MAPLE to the linear model and ensemble method (which it uses), you can run experiments/run.py. Currently, it will only do 1 run per dataset, but this can easily be adapted (change the range value in the script).