You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you have a response variable with several labels and provide a data.frame with several rows in ceteris_paribus, it returns an error like this:
Error in `$<-.data.frame`(`*tmp*`, "_ids_", value = c(1L, 1L, 1L, 1L, :
replacement has 400 rows, data has 80
This can be corrected with the following change:
In the file ceteris.paribus.R, line 146 is: new_observation_ext$`_ids_` <- rep(1:nrow(new_observation), each = nrow(new_observation))
it should be: new_observation_ext$`_ids_` <- rep(1:nrow(new_observation), each = length(col_yhat))
Toy example:
library("randomForest")
library("DALEX")
titanic <- na.omit(titanic)
# we predict embarked instead of survived for generating the bug
model_titanic_rf <- randomForest(embarked ~ gender + age + class + survived +
fare + sibsp + parch, data = titanic)
model_titanic_rf
explain_titanic_rf <- explain(model_titanic_rf,
data = titanic[,-4],
y = titanic$survived,
label = "Random Forest v7")
# select few passangers
selected_passangers <- select_sample(titanic, n = 20)
cp_rf <- ceteris_paribus(explain_titanic_rf, selected_passangers)
cp_rf
The text was updated successfully, but these errors were encountered:
When you have a response variable with several labels and provide a data.frame with several rows in
ceteris_paribus
, it returns an error like this:This can be corrected with the following change:
In the file ceteris.paribus.R, line 146 is:
new_observation_ext$`_ids_` <- rep(1:nrow(new_observation), each = nrow(new_observation))
it should be:
new_observation_ext$`_ids_` <- rep(1:nrow(new_observation), each = length(col_yhat))
Toy example:
The text was updated successfully, but these errors were encountered: