GithubHelp home page GithubHelp logo

introspective's Introduction

ML Insights

Package to understand Supervised ML Models. This package has been tested with Scikit-Learn and XGBoost library. It should work with any machine learning library that has a predict and predict_proba methods for regression and classification estimators.

There are currently two main sets of capabilities of this package. The first is around understanding "black-box" models via the "Model X-Ray". The second is for probability calibration.

For understanding black-box models, the main entry point is the ModelXRay class. Instantiate it with the model and data. The data can be what the model was trained with, but intended to be used for out of bag or test data to see how the model performs when one feature is changed, holding everything else constant.

For probability calibration, the main class is the SplineCalibratedClassifierCV. Using this class you can train your base model, and the corrective calibration function with just a couple of lines of code. See the examples by following the link below.

Python

Python 2.7 and 3.4+

Disclaimer

We have tested this tool to the best of our ability, but understand that it may have bugs. It was developed on Python 3.5, so should work better with Python 3 than 2. Use at your own risk, but feel free to report any bugs to our github. <https://github.com/numeristical/introspective>

Installation

$ pip install ml_insights

Usage

>>> import ml_insights as mli
>>> xray = mli.ModelXRay(model, data)
>>> rfm = RandomForestClassifier(n_estimators = 500, class_weight='balanced_subsample')
>>> rfm_cv = mli.SplineCalibratedClassifierCV(rfm)
>>> rfm_cv.fit(X_train,y_train)
>>> test_res_calib_cv = rfm_cv.predict_proba(X_test)[:,1]
>>> log_loss(y_test,test_res_calib_cv)

Source

Find the latest version on github: https://github.com/numeristical/introspective

Feel free to fork and contribute!

License

Free software: MIT license

Developed By

  • Brian Lucena
  • Ramesh Sampath

References

Alex Goldstein, Adam Kapelner, Justin Bleich, and Emil Pitkin. 2014. Peeking Inside the Black Box: Visualizing Statistical Learning With Plots of Individual Conditional Expectation. Journal of Computational and Graphical Statistics (March 2014)

introspective's People

Contributors

sampathweb avatar blucena avatar

Watchers

Alex Huang 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.