← all repositories
csinva/imodels

A toolbox for when your model needs to explain itself

Sklearn-compatible implementations of interpretable ML models—rule lists, sparse trees, and more—so you can trade black boxes for human-readable logic without rewriting your pipeline.

1.6k stars Jupyter Notebook ML FrameworksOther AI
imodels
Velocity · 7d
+0.6
★ / day
Trend
steady
star history

What it does imodels collects roughly two dozen interpretable classifiers and regressors under one scikit-learn-compatible roof. The API is deliberately boring: fit, predict, predict_proba, print(model). The payoff is that the fitted models spit out actual rules or tiny trees you can read over coffee.

The interesting bit The package doesn’t just wrap CART. It pulls in research implementations—Bayesian rule lists, optimal sparse trees (GOSDT), hierarchical shrinkage for post-hoc regularization, FIGS (sums of small trees)—that are otherwise scattered across individual repos and half-finished theses. The “distillation” and “AutoML” wrappers are a nice touch: train the black box first, then squeeze it into something auditable.

Key highlights

  • Full sklearn compatibility: drop-in replacements for pipelines, GridSearchCV, etc.
  • Covers four model families: rule sets, rule lists, rule trees, and algebraic models (e.g., sparse integer linear models)
  • Includes recent research methods: FIGS, hierarchical shrinkage, RF+ feature importance
  • Post-hoc tools: distillation wrapper, AutoML wrapper, uncertainty estimation demos
  • Published in JOSS; supports Python 3.9–3.11

Caveats

  • Some Bayesian methods are explicitly marked “slow” in the docs
  • A few listed models are “coming soon” (Lightweight Rule Induction, MLRules)
  • The README claims accuracy is often not sacrificed, but no benchmarks are shown—your mileage will vary by dataset

Verdict Worth a look if you work in regulated industries, healthcare, or anywhere a regulator asks “why did it say no?” Not for you if your only metric is Kaggle leaderboard position and you don’t care which features matter.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.