ExplainToolkit

ExplainToolkit is the main interface of scikit-explain. After initializing ExplainToolkit with an estimator and some data, all the explainability methods and their respective plotting modules are called from ExplainToolkit. To initialize ExplainToolkit requires:

  • estimators, a tuple of (estimator name, pre-fit estimator object) (or list thereof).

  • X and y (to evaluate the model on)

    • Can be pandas.DataFrame or numpy.array. If you use an numpy.array, then you must provide the feature names ('feature_names').

[3]:
import sys, os
sys.path.insert(0, os.path.dirname(os.getcwd()))
import skexplain
[4]:
estimators = skexplain.load_models()
X,y = skexplain.load_data()

print(estimators)
print(f'X Shape : {X.shape}')
print(f'y Skew : {y.mean()*100}%')
[('Random Forest', RandomForestClassifier(min_samples_leaf=5, n_estimators=200, n_jobs=5)), ('Gradient Boosting', GradientBoostingClassifier()), ('Logistic Regression', LogisticRegression(C=1))]
X Shape : (100000, 30)
y Skew : 39.173%
[5]:
explainer = skexplain.ExplainToolkit(estimators=estimators, X=X, y=y,)