by Gregory Plumb, Denali Molitor and Ameet S. Talwalkar ([paper] [blog])
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)
from skmaple import MAPLE
maple = MAPLE(rf, lr)
maple.fit(X_train, y_train)
preds = maple.predict(X_test)
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).