Overview
DecisionListClassifier is an interpretable rule-based classifier that wraps the SkopeRules algorithm, producing ordered decision lists where each rule has associated precision and recall metrics.
Description
This module implements a decision list classifier within the InterpretML framework:
- DecisionListClassifier: A glassbox classifier that wraps the
SkopeRules algorithm from the skrules package. It produces an ordered list of human-readable if-then rules. Each rule has an associated precision (confidence) and recall. Instances are classified by the first matching rule in the list, with a default "No Rules Triggered" fallback that predicts the base rate. The class supports both global and local explanations.
- RulesExplanation: Custom explanation class that renders rules as formatted HTML tables. Global explanations show all rules or rules filtered by a specific feature. Local explanations show which specific rule was triggered for a given instance.
During fitting, the classifier maps feature names to internal identifiers (prefixed with __C__), trains SkopeRules, then extracts and reformats the learned rules back to the original feature names. Rules are sorted by precision in descending order.
Prediction works by matching instances against rules in order; the precision of the first matching rule is used as the probability estimate for the positive class.
Usage
Use DecisionListClassifier when you need a classification model that produces human-readable rules, such as in clinical decision support, fraud detection, or any domain where model transparency via explicit rules is required. It requires the skrules (skope-rules) package.
Code Reference
Source Location
Signature
class DecisionListClassifier(ClassifierMixin, ExplainerMixin):
available_explanations = ["global", "local"]
explainer_type = "model"
def __init__(self, feature_names=None, feature_types=None, **kwargs):
def fit(self, X, y):
def predict(self, X):
def predict_proba(self, X):
def explain_local(self, X, y=None, name=None):
def explain_global(self, name=None):
Import
from interpret.glassbox import DecisionListClassifier
I/O Contract
Constructor Inputs
| Name |
Type |
Required |
Description
|
| feature_names |
list of str |
No |
List of feature names
|
| feature_types |
list of str |
No |
List of feature types (e.g. "continuous", "nominal", "ordinal")
|
| **kwargs |
varies |
No |
Keyword arguments passed to the underlying SkopeRules constructor
|
fit Inputs
| Name |
Type |
Required |
Description
|
| X |
numpy array or compatible |
Yes |
Training feature matrix
|
| y |
numpy array |
Yes |
Training classification labels (1-dimensional)
|
predict Outputs
| Name |
Type |
Description
|
| predictions |
numpy array |
Predicted class labels based on rule matching
|
predict_proba Outputs
| Name |
Type |
Description
|
| probabilities |
numpy array (n_samples, 2) |
Class probability estimates based on rule precision
|
explain_global Outputs
| Name |
Type |
Description
|
| explanation |
RulesExplanation |
Global explanation listing all rules with precision, recall, and outcome
|
explain_local Outputs
| Name |
Type |
Description
|
| explanation |
RulesExplanation |
Local explanation showing which rule was triggered for each instance
|
Usage Examples
Basic Example
from interpret.glassbox import DecisionListClassifier
from sklearn.datasets import load_breast_cancer
X, y = load_breast_cancer(return_X_y=True)
dlc = DecisionListClassifier(max_depth=3, n_estimators=30)
dlc.fit(X, y)
# Global explanation - view all rules
global_exp = dlc.explain_global(name="Decision List")
global_exp.visualize(key=None) # All rules as HTML table
# Per-feature view
global_exp.visualize(key=0) # Rules involving feature 0
# Local explanation
local_exp = dlc.explain_local(X[:5], y[:5])
local_exp.visualize(key=0) # Which rule triggered for first instance
Related Pages