Closed marboe123 closed 2 years ago
Hello,
After fitting a xgboost model I do:
shap_values <- explain(model_n, X = trainval)
I receive this error:
[[Error in UseMethod("explain") : no applicable method for 'explain' applied to an object of class ["xgb.Booster"]]
If I use this line:
shap_values <- fastshap::explain(model_n, X = trainval)
Error in explain.default(object, feature_names = feature_names, X = X, : argument "pred_wrapper" is missing, with no default
trainval is a dataframe with traindata. It does not contain the Y values. I have also tried to feed it as matrix although this gives the same error.
Any idea what could be the cause?
Thanks a lot!
Addinglibrary(vip) besideslibrary(fastshap)to my code did solve the issue for using shap_values <- fastshap::explain(model_n, X = trainval)
library(vip)
library(fastshap)
Hello,
After fitting a xgboost model I do:
shap_values <- explain(model_n, X = trainval)
I receive this error:
If I use this line:
shap_values <- fastshap::explain(model_n, X = trainval)
I receive this error:
trainval is a dataframe with traindata. It does not contain the Y values. I have also tried to feed it as matrix although this gives the same error.
Any idea what could be the cause?
Thanks a lot!