Closed fysqy closed 1 year ago
Hi @fysqy, can you provide a reproducible example for me to run on my end?
@fysqy Your predict function seems to be wrongly specified. It should return predictions calculated from the input of pfun
Good catch @mayer79! @fysqy there should be plenty of examples in the docs and website, but feel free to reopen if you still have trouble.
library(fastshap) library(randomForest) model1rf1 <- rf1[["finalModel"]] pfun <- function(model1rf1, newdata) { p_deri1rf1$Y }
Compute fast (approximate) Shapley values using 10 Monte Carlo repetitions
system.time({ # estimate run time set.seed(5038) shap <- fastshap::explain(model1rf1, X = deridata1_x, pred_wrapper = pfun, nsim = 10,) })
When I run the above code, all the shap values I get are 0.