I found that modelStudio would not allow a model_explainer object when model has only one variable.
There is the following example:
titanic_imputed_sub <- subset(titanic_imputed, select = c("survived", "class"))
model_titanic <- glm(survived ~ class, data = titanic_imputed_sub, family = "binomial")
# create an explainer for the model
explainer_titanic <- explain(model_titanic,
data = titanic_imputed_sub,
y = titanic_imputed$survived,
label = "Titanic GLM")
# pick observations
new_observations <- titanic_imputed[1:2,]
rownames(new_observations) <- c("Lucas","James")
# make a studio for the model
modelStudio(explainer_titanic,
new_observations, eda=FALSE,
N = 200, B = 5)
Calculating ...
Calculating ingredients::feature_importance
Elapsed time: 00:00:00 ETA: 0s Error in `[.default`(data, , , drop = FALSE) : 維度數目不正確
此外: Warning message:
In value[[3L]](cond) :
Error occurred in ingredients::feature_importance function: 長度為 0 的引數
Called from: NextMethod("[")
Dear Maintainer
I found that modelStudio would not allow a model_explainer object when model has only one variable. There is the following example: