Shap values with tidymodels and SHAPforxgboost

I'm having the same issue found in https://community.rstudio.com/t/shap-values-with-tidymodels

The shap values are reverse to what is expected of the meaning of my variables.

Someone can please provide any comment?

I found out that doing the simple follow step would invert all directions of SHAP value and result in the expected figure:

dm_shap$value = - dm_shap$value

image

Also, library(shapviz) produces that expected results with better looking graphics.

So tidymodels chooses the first level of a binary factor as the event of interest. The happens in yardstick and there are options to invert that. I don't know if that is the issue but it sounds like a good possibility. Perhaps give that a try?