ibreakdown - 具有交互功能的模型无关解释
项目描述
ibreakdown
ibreakdown 是一个具有交互功能、针对模型无关预测的解释库,该库可以显示每个特征在预测值中的贡献。
SHAP 或 LIME 只考虑局部加性特征归因,而 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。
与 pandas 和 numpy 兼容
支持特征之间的交互
安装
安装过程简单,只需
$ pip install ibreakdown
要求
变更
项目详情
关闭
ibreakdown-0.0.1a4.tar.gz的哈希
算法 | 哈希摘要 | |
---|---|---|
SHA256 | fd3cccd6ade5be548a6f6830c41a08208302461491df05941b444ad2b71b1c88 |
|
MD5 | 4c1c6af8f21bc9a484939edc2c97f7b2 |
|
BLAKE2b-256 | 08396a6cf178790750dc2dd099969de0fed5119e86344b8f04f72109303b7215 |