【问题标题】:Generating local interpretations using Shap Kernel Explainer使用 Shap Kernel Explainer 生成本地解释
【发布时间】:2020-06-21 07:34:06
【问题描述】:

我正在尝试使用 shap 内核解释器来解释我的模型。数据集的形状为 (176683, 42)。解释器(xgbexplainer)建模成功,当我使用它生成 shap_values 时,它会抛出内存错误。

import shap
xgb_explainer = shap.KernelExplainer(trained_model.steps[-1][-1].predict,X_for_shap.values)
shap_val = xgb_explainer.shap_values(X_for_shap.loc[0], nsamples=1)

首先我使用 nsamples 作为默认值 = 2*X_for_shap.shape[2] + 2048,它返回 MemoryError: Unable to allocate array with shape (2132, 7420686) and data type float64

当我将它设置为 nsamples = 1 时,它会无限期地运行。请帮助我了解我在这里做错了什么

This is the screenshot of the error message

【问题讨论】:

    标签: machine-learning out-of-memory xgboost interpretation shap


    【解决方案1】:

    关于内核解释器,我不明白的一件事是为什么我们需要用一些策略(均值、中值 k 均值等)来估算缺失的特征?为什么不忽略它们并拟合线性学习器并将其与模型进行比较而不观察该特征呢? P( y| {S} U 特征_i ) - P( y | { S } ) ? SHAP 方法提供了什么样的附加值,具有全部功能但其中一些是未知的?

    【讨论】:

      猜你喜欢
      • 2022-10-03
      • 1970-01-01
      • 2018-04-13
      • 2021-12-19
      • 1970-01-01
      • 1970-01-01
      • 2022-06-14
      • 2020-07-02
      相关资源
      最近更新 更多