Decision Rule#

Link to API Reference: DecisionListClassifier

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[1], 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.

Christoph Molnar’s “Interpretable Machine Learning” e-book [2] has an excellent overview on decision rules that can be found here.

For implementation specific details, see the skope-rules GitHub repository here.

Code Example#

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
import numpy as np
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from sklearn.metrics import roc_auc_score

from interpret.glassbox import DecisionListClassifier
from interpret import show

seed = 42
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), y_train)

auc = roc_auc_score(y_test, dl.predict_proba(X_test)[:, 1])
print("AUC: {:.3f}".format(auc))
/opt/hostedtoolcache/Python/3.8.17/x64/lib/python3.8/site-packages/sklearn/ensemble/ FutureWarning: `base_estimator` was renamed to `estimator` in version 1.2 and will be removed in 1.4.
/opt/hostedtoolcache/Python/3.8.17/x64/lib/python3.8/site-packages/sklearn/ensemble/ FutureWarning: `base_estimator` was renamed to `estimator` in version 1.2 and will be removed in 1.4.
AUC: 0.918