See the backing repository for Skope Rules here.
Decision rules are logical expressions of the form
IF ... THEN .... Interpret’s implementation uses a wrapped variant of
skope-rules, which is a weighted combination of rules extracted from a tree ensemble using L1-regularized optimization over the weights. Rule systems, like single decision trees, can give interpretability at the cost of model performance. These discovered decision rules are often integrated into expert-driven rule-based systems.
How it Works¶
The creators of skope-rules have a lucid synopsis of what decision rules are here.
For implementation specific details, see the skope-rules GitHub repository here.
The following code will train an skope-rules classifier for the breast cancer dataset. The visualizations provided will be for both global and local explanations.
from interpret import set_visualize_provider from interpret.provider import InlineProvider set_visualize_provider(InlineProvider())
from sklearn.datasets import load_breast_cancer from sklearn.model_selection import train_test_split from interpret.glassbox import DecisionListClassifier from interpret import show seed = 1 X, y = load_breast_cancer(return_X_y=True, as_frame=True) X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.20, random_state=seed) dl = DecisionListClassifier(random_state=seed) dl.fit(X_train, y_train) dl_global = dl.explain_global() show(dl_global) dl_local = dl.explain_local(X_test[:5], y_test[:5]) show(dl_local)