Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SHAP (SHapley Additive exPlanations)

A notebook for SHAP in python

SHAP (SHapley Additive exPlanations) is a game theoretic approach to explain the output of any machine learning model. It connects optimal credit allocation with local explanations using the classic Shapley values from game theory and their related extensions.

Main Idea

The main idea of SHAP rests upon the following equation where it captures the average marginal contribution of a feature value (player) across all possible coalitions (society).

Shapley value formula

where n is the total number of players and the sum extends over all subsets S of N not containing player i. The formula can be interpreted as follows: imagine the coalition being formed one actor at a time, with each actor demanding their contribution as a fair compensation, and then for each actor take the average of this contribution over the possible different permutations in which the coalition can be formed.

Reference: Shapley Values

Enviornment

The enviornment is as follows:

Sample Dataset

The dataset used in this notebook is taken from the Kaggle-titanic competition. The main objective is to predict wheather a passenger will survive.

SHAP analysis

Features Summary Plot

Summary

Features Summary Bar

Bar_summary

Explained by Sex

Sex

Explained by Pclass

Pclass

Explained by Age

Age

About

Notebook for using SHAP (SHapley Additive exPlanations) in python.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages