csinva/imodels

Interpretable ML package 🔍 for concise, transparent, and accurate predictive modeling (sklearn-compatible).

What it solves

Modern machine-learning models are increasingly complex, which makes them hard to understand and trust. This package offers a collection of interpretable models — models whose decisions a person can actually read and follow — that can often replace black-box models like random forests. The goal is to get similar predictive accuracy while gaining transparency and faster computation.

How it works

You use the models exactly like standard scikit-learn models: import a classifier or regressor, call fit on your data, then predict (or predict_proba) on new data. The package bundles many model families that all share this same API, so you can swap between them easily. The models fall into four broad forms: rule sets (a collection of if-then rules), rule lists (an ordered chain of rules), rule trees (a branching set of rules), and algebraic models (like sparse linear models with integer coefficients). It also includes a visualization tool (viz.draw) that can render a fitted model as a diagram, plus demo notebooks showing real use cases such as deriving a clinical decision rule.

Who it’s for

Data scientists and machine-learning practitioners who need models that are easy to explain — for example, in medicine or other regulated settings where a decision must be justified. It’s also useful for anyone who wants to compare interpretable alternatives to black-box models without learning a new framework, since everything follows the familiar scikit-learn interface.

Highlights

  • Scikit-learn compatible: every model follows the standard fit/predict/predict_proba API and works inside sklearn pipelines and grid searches.
  • Wide model catalog: rule sets, rule lists, rule trees, and algebraic models — including RuleFit, Bayesian rule lists, CART/C4.5 trees, sparse integer linear models, and more.
  • Built-in visualization: draw a fitted model as a diagram to inspect its structure.
  • Accuracy without opacity: aims to replace black-box models with simpler, interpretable ones while preserving predictive performance.
  • Task coverage: many models support both binary classification and regression, with a few specialized ones (e.g., risk scores for binary targets).
  • Demo notebooks: quickstart, AutoML selection, and a clinical decision-rule example to get started fast.

Related

  • Project
  • Project
  • Project
  • Project
  • Project