shap force plots for multiclass problems

38 views Asked by At

I am trying to get to show the force plots for a given test example to all show in the same plot in the case of a multiclass classification problem.

My best attempt:

explainer = shap.TreeExplainer(model)

shap_test = explainer.shap_values(x_test)

fig, axs = plt.subplots(6, 1, figsize=(10, 5 * 6))

for i in range(6):
    axs[i].set_title(f"Waterfall Plot - Class {i}")

    decision_plot = shap.force_plot(
        explainer.expected_value[i], shap_test[0][i], x_test.columns, show=False
    )
plt.show()

Unfortunately this still miserably fails: enter image description here

Does anyone have a solution for this?

0

There are 0 answers