Giter VIP home page Giter VIP logo

imodels's Introduction

Interpretable machine learning models (imodels) ๐Ÿ”

Straightforward implementations of interpretable ML models + demos of how to use various interpretability techniques. Code is optimized for readability. Pull requests very welcome!

Docs โ€ข Implementations of imodels โ€ข Demo notebooks

Implementations of interpretable models

Scikit-learn style wrappers/implementations of different interpretable models. The interpretable models can be easily installed and used:

pip install git+https://github.com/csinva/imodels (see here for more help)

from imodels import RuleListClassifier, GreedyRuleListClassifier, SkopeRulesClassifier, IRFClassifier
from imodels import SLIMRegressor, RuleFitRegressor

model = RuleListClassifier()  # initialize Bayesian Rule List
model.fit(X_train, y_train)   # fit model
preds = model.predict(X_test) # discrete predictions: shape is (n_test, 1)
preds_proba = model.predict_proba(X_test) # predicted probabilities: shape is (n_test, n_classes)
  • bayesian rule list (docs, ref implementation, paper) - learn a compact rule list
  • rulefit (docs, ref implementation, paper) - find rules from a decision tree and build a linear model with them
  • skope-rules (docs, ref implementation) - extracts rules from base estimators (e.g. decision trees) then tries to deduplicate them
  • sparse integer linear model (docs, cvxpy implementation, paper)
  • greedy rule list (docs, ref implementation) - uses CART to learn a list (only a single path), rather than a decision tree
  • (in progress) iterative random forest (docs, ref implementation, paper)
  • (in progress) optimal classification tree (docs, ref implementation, paper) - learns succinct trees using global optimization rather than greedy heuristics
  • (coming soon) rule ensembles - e.g. SLIPPER, Lightweight Rule Induction, MLRules
  • (coming soon) gams
  • (coming soon) symbolic regression

Demo notebooks

The demos are contained in 3 main notebooks, following this cheat-sheet:cheat_sheet

  • model_based.ipynb - how to use different interpretable models and examples with the imodels package
    • see an example of using this package for deriving a clinical decision rule in this nb

After fitting models, we can also do posthoc analysis as shown in these two notebooks:

References

  • Readings
    • Interpretable Machine Learning: A Guide for Making Black Box Models Explainable (molnar 2019, pdf) - book on interpretable ML
    • Interpretable machine learning: definitions, methods, and applications (murdoch et al. 2019, pdf) - good quick review on interpretable ML
    • Stop Explaining Black Box Machine Learning Models for High Stakes Decisions and Use Interpretable Models Instead (rudin 2019, pdf) - good explanation of why one should use interpretable models
    • Review on evaluating interpretability (doshi-velez & kim 2017, pdf)
  • Reference implementations (also linked above): the code here heavily derives from (and in some case is just a wrapper for) the wonderful work of previous projects. We seek to to extract out, combine, and maintain select relevant parts of these projects.

For updates, star the repo, see this related repo, or follow @chandan_singh96. Please make sure to give authors of original methods / base implementations appropriate credit!

imodels's People

Contributors

csinva avatar bachsh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.