Why are the Shap Values extracted from a RBF SVM model sometimes all equal to 0?

53 Views Asked by At

1I'm testing different models for a classification task. This problem occurs (to my knowledge) only (and not always) when I extract the shap values from a RBF SVM model (example in the image).

I planned to obtain a more classic representation of the Shap Values plot, with all the points having a different value on the y axis. Here, it seems that all my points have a 0 values

my code is a bit different but here is what it does:

explainer = shap.KernelExplainer(model['model'].predict, shap.kmeans(X_processed, 100))
shap_values = explainer.shap_values(X_processed)

shap_fig = shap.summary_plot(shap_values=shap_values, features=X_processed, feature_names=feature_names, show=False, max_display=10)
fig, ax = plt.gcf(), plt.gca()
ax.set_yticklabels(labels, rotation=45, fontsize=11)
ax.set_xticklabels(np.round(ax.get_xticks(), 2),fontsize=11)
plt.title(plot_title, fontsize = 18)
fig.tight_layout(pad=0, w_pad=0, h_pad=0)
fig.show()

In this case, here is the results as an image.Shap Values plot with only 0 values What I don't understand is that for another dataset, the shap values plot is as expected even with a RBF SVM model.

I already tried to use "X_preprocessed" instead of the "shap.kmeans(X_processed, 100)" in the shap.KernelExplainer(), and I tried different numbers as argument in the shap.kmeans(), but the results stay the same. Did someone already encounter this behaviour? Or any ideas why this can occur?

0

There are 0 best solutions below