Skip to content

Add imodels.viz, print(model) for every model, and imodels.to_sklearn

Latest

Choose a tag to compare

@csinva csinva released this 06 Oct 14:39
· 16 commits to master since this release

New

  • imodels.viz: visualize any fitted model. viz.draw(model, X, y) makes a static figure (SVG, PNG, PDF) and viz.interactive(model, X, y) an offline interactive page (also inline in Jupyter): fold the model, run a sample through it, and see the smallest changes that would flip its prediction. It covers the imodels trees, sums of trees, rule lists, rule sets, scoring systems and additive models, plus scikit-learn trees, forests, boosting and linear models. Every view is tested to reproduce its model's predict / predict_proba. See the gallery post.
  • print(model) shows the fitted model as readable text for every model imodels.viz reads: trees with their conditions and leaf outcomes, rule lists as IF / ELSE IF rows, rule sets ranked by effect, scorecards with the risk for each total, and a sparkline per feature for GAMs (also imodels.viz.text(model)).
  • imodels.to_sklearn(model) exports every tree-based model (CART variants, HSTree, TAO, C4.5, FastSmallTree, FIGS, IRF) to the scikit-learn estimator that makes the same predictions, so dtreeviz, sklearn.tree.plot_tree and export_text work on all of them.

Fixes

  • BoostedRulesClassifier and SlipperClassifier rules match the model's predictions under both SAMME and SAMME.R (older scikit-learn).
  • BayesianRuleSetClassifier no longer crashes on some inputs.
  • Names passed to fit(feature_names=...) take precedence over DataFrame columns when printing.

Docs

  • Parameters render properly on every API page, and the API pages are more compact (scikit-learn's estimator plumbing is no longer listed on every model page).
  • New imodels.viz post with a gallery of 32 examples; the FIGS and hierarchical-shrinkage posts and the readme now draw their models with imodels.viz; a new readme animation and model-categories figure.
  • Faster test suite, run in parallel with pytest-xdist.