-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in ranger.unify() #39
Comments
Please add a minimal reproducible example. |
@mayer79 I've been running into the same issue, plus an error where library(treeshap)
library(ranger)
library(dplyr)
library(mlr)
set.seed(1)
data(iris)
dat_prepared <- iris
dat_prepared$Species <- as.factor(dat_prepared$Species)
predictors <- dat_prepared %>% select(-Species)
predictors_encoded <- createDummyFeatures(predictors)
dat_encoded <- cbind(predictors_encoded, Species = dat_prepared$Species)
rf <- ranger(Species ~ ., data = dat_encoded)
unified_model <- ranger.unify(rf, dat_encoded)
shaps <- treeshap(unified_model, dat_encoded[1:50, ]) After I'm using |
@nlebovits I am not maintainer. SHAP can't be calculated for non-probabilistic classification models. It requires numeric predictions, e.g., logit probabilities. There is an open PR that allows probabilistic classification for ranger objects: Maybe you can test this? library(remotes)
install_github("ModelOriented/treeshap", ref = github_pull("43")) |
I tried to unify my binary classification rf model trained by ranger. There is an error
Warning message:
In Ops.factor(get("Prediction"), n) : ‘/’ not meaningful for factors
I don't know how to get rid of it and make my code run. Any idea about this error would be appreciated.
The text was updated successfully, but these errors were encountered: