Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
221 views
in Technique[技术] by (71.8m points)

python - <Simple SHAP value calculation Question> #force_plot,shap_value,local_interpretation(<Simple SHAP value calculation Question> #force_plot, shap_value, local_interpretation)

I have a simple calculation question.

(我有一个简单的计算问题。)

I have a trouble to calculate 'Contribution of feature'.

(我在计算“功能贡献”时遇到麻烦。)

Model : LightGBM (Python 3.7) Objective : Classification

(型号:LightGBM(Python 3.7)目标:分类)

My shap values are below.

(我的shap值如下。)

( There are 6 features )

((有6个功能))

LIMIT_BAL |

(LIMIT_BAL |)

SEX |

(性|)

EDUCATION |

(教育|)

MARRIAGE |

(婚姻|)

AGE |

(年龄|)

PAY_0 |

(PAY_0 |)

-0.344984 |

(-0.344984 |)

-0.033723 |

(-0.033723 |)

0.012379 |

(0.012379 |)

0.019236 |

(0.019236 |)

-0.013549 |

(-0.013549 |)

0.706214 |

(0.706214 |)

And Model's Prediction and Base value are below.

(模型的预测值和基础值如下。)

prediction : 27.62% base value : 19.29%

(预测:27.62%基础值:19.29%)

Prediction |

(预测|)

Base Value |

(基本价值)

Prediction - Base Value |

(预测-基本值|)

0.276298 |

(0.276298 |)

0.192927 |

(0.192927 |)

0.083371 |

(0.083371 |)

I want to calculate individual feature's contribution.

(我要计算单个功能的贡献。)

Question) How can I calculate the contribution?

(问题)我如何计算捐款?)

I thought below solution.

(我认为下面的解决方案。)

For example,

(例如,)

'Contribution of PAY_0' = (shap value(PAY_0) / sum of shap values) * (prediction - base value)

('PAY_0的贡献'=(shap值(PAY_0)/ sap值之和)*(预测-基本值))

= 0.706214/(-0.344984 + -0.033723 + 0.012379 + 0.019236 + -0.013549 + 0.706214 ) * 0.0083371

(= 0.706214 /(-0.344984 + -0.033723 + 0.012379 + 0.019236 + -0.013549 + 0.706214)* 0.0083371)

= 0.170378 = 17.03%

(= 0.170378 = 17.03%)

I don't know the right way.

(我不知道正确的方法。)

Thanks.

(谢谢。)

  ask by J L translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...