Re section: Comprehensive Software Examples and Tutorials (Interpreting Machine Learning Models with the iml Package)
I am getting the following error when trying to execute the following code in section entitled "Replication requirements" (https://uc-r.github.io/iml-pkg):
Unfortunately, I got another error after trying to execute the following code (section entitled "Global interpretation/Feature importance" (https://uc-r.github.io/iml-pkg):
compute feature importance with specified loss metric
imp.glm <- FeatureImp$new(predictor.glm, loss = "mse")
imp.rf <- FeatureImp$new(predictor.rf, loss = "mse")
imp.gbm <- FeatureImp$new(predictor.gbm, loss = "mse")
Error in [.data.frame(prediction, , self$class, drop = FALSE) : undefined columns selected
Error in [.data.frame(prediction, , self$class, drop = FALSE) : undefined columns selected
Error in [.data.frame(prediction, , self$class, drop = FALSE) : undefined columns selected
Re section: Comprehensive Software Examples and Tutorials (Interpreting Machine Learning Models with the iml Package) I am getting the following error when trying to execute the following code in section entitled "Replication requirements" (https://uc-r.github.io/iml-pkg):
classification data
df <- rsample::attrition %>% mutate_if(is.ordered, factor, ordered = FALSE) %>% mutate(Attrition = recode(Attrition, "Yes" = "1", "No" = "0") %>% factor(levels = c("1", "0")))
The problem was solved using the following code: (...) h2o.init()
data
library(modeldata) data("attrition", package = "modeldata")
classification data
df <- attrition %>% mutate_if(is.ordered, factor, ordered = FALSE) %>% mutate(Attrition = recode(Attrition, "Yes" = "1", "No" = "0") %>% factor(levels = c("1", "0")))
Unfortunately, I got another error after trying to execute the following code (section entitled "Global interpretation/Feature importance" (https://uc-r.github.io/iml-pkg):
compute feature importance with specified loss metric
imp.glm <- FeatureImp$new(predictor.glm, loss = "mse") imp.rf <- FeatureImp$new(predictor.rf, loss = "mse") imp.gbm <- FeatureImp$new(predictor.gbm, loss = "mse")
I use R 4.2.0/ Win10