ModelOriented / DALEX

moDel Agnostic Language for Exploration and eXplanation

Home Page:https://dalex.drwhy.ai

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

predict_profile fails for penguins data because it is a tibble

pbiecek opened this issue · comments

this code generates an error

library("palmerpenguins")
data("penguins", package = "palmerpenguins")

library("mlr3")
library("mlr3learners")

penguins = na.omit(penguins)
task_peng = as_task_classif(penguins, target = "species")


learner = lrn("classif.ranger")
learner$predict_type = "prob"
learner$train(task_peng)

library("DALEX")
library("DALEXtra")

ranger_exp = explain_mlr3(learner,
  data = penguins[test_set, ],
  y = penguins[test_set, "species"],
  label = "Ranger RF",
  colorize = FALSE)

mumble <- penguins[1,]

predict(ranger_exp, mumble)

pmp1cp <- predict_profile(ranger_exp, as.data.frame(mumble))
plot(pmp1cp)

because all_observations[, var] for tibble does not produce vector, it stays a tibble

suggested solution: use all_observations[[var]]

candidate fix in ModelOriented/ingredients@f061a70
is working with ingredients 2.3.0 and above