1

我正在使用 DeepCTR(版本0.7.5)keras 库来预测 ctr(使用 DeepFM)
https://deepctr-doc.readthedocs.io/en/latest/deepctr.models.deepfm.html
这是适合模型的代码的一个小示例:

#Imports, then feature preperation...

model = DeepFM(linear_feature_columns, dnn_feature_columns, task='binary')
model.compile(optimizer, loss)
train_model_input = [train_df[name] for name in feature_names]
model.fit(x=train_model_input, y=train_df[TARGET].values, validation_split=0.3)

但是当我尝试以下操作时:

e = shap.DeepExplainer(model, test_df.head(50))

我收到以下错误:

ValueError: Cannot feed value of shape (50, 17) for Tensor 'x:0', which has shape '(?, 1)'

我查看了整个谷歌并尝试使用输入形状和 SHAP API,但对我没有任何帮助。
附加信息
模型输入格式(17 个值)为:

[<tf.Tensor 'x:0' shape=(?, 1) dtype=int32>, <tf.Tensor 'x1:0' shape=(?, 1) dtype=int32>...

输出是:

<tf.Tensor 'prediction_layer/Reshape:0' shape=(?, 1) dtype=float32>
4

0 回答 0