Code Monkey home page Code Monkey logo

shap-classification-example's Introduction

Medium Twitter Linkedin

SHAP: Shapley Additive Explanations

This repository contains an example on how to implement the shap library to interpret a machine learning model.

If you want to know in detail how SHAP works, what its components are and how to interpret ML models with the shap library, I recommend you to take a look at the article: SHAP: Shapley Additive Explanations

Table of Contents

1. How to use

There are 2 steps that you should follow, first you have to preprocess the dataset by typing:

from src.preprocess import Data
data = Data(csv_path='data/prostate_cancer.csv')

then, for training and optimizing the classifier, you need to type:

from src.model import Classifier
classifier = Classifier(x_train=data.x_train, x_test=data.x_test, y_train=data.y_train, y_test=data.y_test)

It is important to mention that the approach shown in this repository is aligned with the examples shown in the SHAP article: Shapley Additive Explanation. Also, for ease you can use the demo implemented in the jupyter notebook shap_demo.ipynb.

4. Contributing

Feel free to fork the model and add your own suggestiongs.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/YourGreatFeature)
  3. Commit your Changes (git commit -m 'Add some YourGreatFeature')
  4. Push to the Branch (git push origin feature/YourGreatFeature)
  5. Open a Pull Request

5. Contact

If you have any question, feel free to reach me out at:

6. License

Distributed under the MIT License. See LICENSE.md for more information.

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.