Plot centered ICE profiles with centered PDP curves
g_ice.Rd
Plot centered ICE profiles with centered PDP curves
Usage
g_ice(
object,
centered = TRUE,
show_PDP = TRUE,
coloured = FALSE,
rug_sides = "b",
missings_spec = missings_specification(),
facet_spec = facet_specification(),
logodds_to_prob = FALSE
)
Arguments
- object
Object of classes
rough
andsculpture
.- centered
logical
, centered ice plots? Defaults toTRUE
.- show_PDP
logical
, show PDP line? Defaults toTRUE
.- coloured
logical
, coloured curves? Defaults toFALSE
.- rug_sides
"" for none, "b", for bottom, "trbl" for all 4 sides (see
geom_rug
)- missings_spec
Object of class
missings_specificatoin
.- facet_spec
Object of class
facet_specificatoin
.- logodds_to_prob
(
logical
) Only valid for binary response and sculptures built on the log-odds scale. Defaults toFALSE
(i.e. no effect). IfTRUE
, then the y-values are transformed through inverse logit function 1 / (1 + exp(-x)).
Examples
df <- mtcars
df$vs <- as.factor(df$vs)
model <- rpart::rpart(
hp ~ mpg + carb + vs,
data = df,
control = rpart::rpart.control(minsplit = 10)
)
model_predict <- function(x) predict(model, newdata = x)
covariates <- c("mpg", "carb", "vs")
pm <- sample_marginals(df[covariates], n = 50, seed = 5)
rs <- sculpt_rough(
dat = pm,
model_predict_fun = model_predict,
n_ice = 10,
seed = 1,
verbose = 0
)
g_ice(rs)$continuous