shap/shap

BUG: Warning: unrecognized nn.Module: Chomp1d

xiaonig opened this issue · 2 comments

Issue Description

Hello I am using SHAP for TCN model interpretation and I found that the following prompt always appears, I am checking the documentation and it says that the layer is not supported in SHAP, is there a solution for this?Looking forward to hearing from you!
image

Minimal Reproducible Example

实现TCN模型SHAP解释
model = TCN(
    input_size, output_size,  num_channels,kernel_size=3, dropout=dropout_rate
    )
model.load_state_dict(torch.load(PATH)
计算训练时的输入SHAP值
train_seq_concat = torch.cat((train_pp, train_con), dim=-1).cpu()
train_background = train_seq_concat[np.random.choice(train_seq_concat.shape[0], 100, replace=False)]
train_explainer = shap.DeepExplainer(model,train_background)
train_shap_values= train_explainer.shap_values(train_seq_concat)
train_shap_values_path=os.path.join(pwd, "xiaoning", "data","result","shp","tcn","1","npy","train_lstm_shap_values.npy")
train_shap_values_npy=np.save(train_shap_values_path,train_shap_values)

Traceback

No response

Expected Behavior

No response

Bug report checklist

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest release of shap.
  • I have confirmed this bug exists on the master branch of shap.
  • I'd be interested in making a PR to fix this bug

Installed Versions

image

I'm using the DeepExplainer method from shap explanatory

Could you please provide a reproducible example so that we can add a test for this once it is fixed?