跳转到主要内容

ibreakdown - 具有交互功能的模型无关解释

项目描述

ibreakdown

https://travis-ci.cn/jettify/ibreakdown.svg?branch=master https://codecov.io/gh/jettify/ibreakdown/branch/master/graph/badge.svg https://img.shields.io/pypi/pyversions/ibreakdown.svg https://img.shields.io/pypi/v/ibreakdown.svg

ibreakdown 是一个具有交互功能、针对模型无关预测的解释库,该库可以显示每个特征在预测值中的贡献。

SHAPLIME 只考虑局部加性特征归因,而 ibreakdown 还评估局部特征交互。

算法

算法基于论文 “iBreakDown: 非加性预测模型的模型解释的不确定性” 中的思想 https://arxiv.org/abs/1903.11420 以及在 R 中的参考实现 (iBreakDown)

算法背后的直觉如下

The algorithm works in a similar spirit as SHAP or Break Down but is not
restricted to additive effects. The intuition is the following:

1. Calculate a single-step additive contribution for each feature.
2. Calculate a single-step contribution for every pair of features. Subtract additive contribution to assess the interaction specific contribution.
3. Order interaction effects and additive effects in a list that is used to determine sequential contributions.

This simple intuition may be generalized into higher order interactions.

更深入的解释可以在算法作者的免费书籍中找到:预测模型:探索、解释和调试 https://pbiecek.github.io/PM_VEE/iBreakDown.html

简单示例

# model = RandomForestClassifier(...)
explainer = ClassificationExplainer(model)
classes = ['Deceased', 'Survived']
explainer.fit(X_train, columns, classes)
exp = explainer.explain(observation)
exp.print()

请在此处查看完整的泰坦尼克号示例: https://github.com/jettify/ibreakdown/blob/master/examples/titanic.py

+------------------------------------+-----------------+--------------------+--------------------+
| Feature Name                       | Feature Value   |   Contrib:Deceased |   Contrib:Survived |
+------------------------------------+-----------------+--------------------+--------------------|
| intercept                          |                 |          0.613286  |          0.386714  |
| Sex                                | female          |         -0.305838  |          0.305838  |
| Pclass                             | 3               |          0.242448  |         -0.242448  |
| Fare                               | 7.7375          |         -0.119392  |          0.119392  |
| Siblings/Spouses Aboard            | 0               |         -0.0372811 |          0.0372811 |
| ('Age', 'Parents/Children Aboard') | [28.0 0]        |          0.0122196 |         -0.0122196 |
| PREDICTION                         |                 |          0.405443  |          0.594557  |
+------------------------------------+-----------------+--------------------+--------------------+

功能

  • 支持分类和回归的预测解释

  • 易于使用的API。

  • pandasnumpy 兼容

  • 支持特征之间的交互

安装

安装过程简单,只需

$ pip install ibreakdown

要求

变更

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分发

ibreakdown-0.0.1a4.tar.gz (9.2 kB 查看哈希)

上传时间

由以下支持