Giter VIP home page Giter VIP logo

skater's Introduction

Skater

Skater is a python package for model agnostic interpretation of predictive models. With Skater, you can unpack the internal mechanics of arbitrary models; as long as you can obtain inputs, and use a function to obtain outputs, you can use Skater to learn about the models internal decision policies.

The package was originally developed by Aaron Kramer, Pramit Choudhary and internal DataScience Team at DataScience.com to help enable practitioners explain and interpret predictive "black boxes" in a human interpretable way.

Build Status

๐Ÿ“– Documentation

Overview Introduction to the Skater library
Installing How to install the Skater library
Tutorial Steps to use Skater effectively.
API Reference The detailed reference for Skater's API.
Contributing Guide to contributing to the Skater project.

๐Ÿ’ฌ Feedback/Questions

Feature Requests/Bugs GitHub issue tracker
Usage questions Gitter chat
General discussion Gitter chat

Install Skater

Dependencies

Skater relies on numpy, pandas, scikit-learn, and the DataScience.com fork of the LIME package. Plotting functionality requires matplotlib, though it is not required to install the package. Currently we only distribute to pypi, though adding a conda distribution is on the roadmap.

pip

When using pip, to ensure your system is not modified by an installation, it is recommended that you use a virtual environment (virtualenv, conda environment).

pip install -U Skater

Usage

The code below illustrates a typical workflow with the Skater package.

import numpy as np
from scipy.stats import norm

#gen some data
B = np.random.normal(0, 10, size = 3)
X = np.random.normal(0,10, size=(1000, 3))
feature_names = ["feature_{}".format(i) for i in xrange(3)]
e = norm(0, 5)
y = np.dot(X, B) + e.rvs(1000)
example = X[0]

#model it
from sklearn.ensemble import RandomForestRegressor
regressor = RandomForestRegressor()
regressor.fit(X, y)


#partial dependence
from skater.core.explanations import Interpretation
from skater.model import InMemoryModel
i = Interpretation()
i.load_data(X, feature_names = feature_names)
model = InMemoryModel(regressor.predict, examples = X)
i.partial_dependence.plot_partial_dependence([feature_names[0], feature_names[1]],
                                            model)

#local interpretation
from skater.core.local_interpretation.lime.lime_tabular import LimeTabularExplainer
explainer = LimeTabularExplainer(X, feature_names = feature_names)
explainer.explain_instance(example,  regressor.predict).show_in_notebook()

Testing

1. If repo is cloned:

python skate/tests/all_tests.py

2. If pip installed:

python -c "from skater.tests.all_tests import run_tests; run_tests()"

skater's People

Contributors

aikramer2 avatar limscoder avatar pramitchoudhary avatar

Watchers

 avatar  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.