微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用Keras模型的DeepExplainer,“ LookupError:渐变注册表没有条目:shap_TensorListStack”

如何解决使用Keras模型的DeepExplainer,“ LookupError:渐变注册表没有条目:shap_TensorListStack”

将DeepExplainer用于Keras顺序模型进行多类文本分类时,出现以下错误。请在下面找到详细信息:

## KERAS版本:2.4.3。

## MODEL

model = Sequential()
model.add(InputLayer (input_shape= (max_len,)))
model.add(Embedding (vocab_size +1,embed_dim,input_length= max_len,weights[embed_matrix]))
model.add(LSTM (LSTM_unit,dropout= dropouts,recurrent_dropout=dropouts,return_sequences=False))
model.add(Dense (6,activation="softmax"))
##DEEPEXPLAINER

explainer = shap.DeepExplainer(model,X_train[:100],learning_phase_flags = None)
shap_values = explainer.shap_values(X_test[:10])

错误

LookupError: gradient registry has no entry for: shap_TensorListStack

请帮助我解决此问题。我已经尝试了存储库中提到的问题中提供的所有可能的解决方案,但无法解决错误

最好的问候, 梅格纳·戈亚(Meghna Goyal)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。