update.EffectData | R Documentation |
Updates an "EffectData" object by
turning discrete values to factor (especially useful with the next option),
collapsing levels of categorical variables with many levels,
dropping empty bins,
dropping small bins,
dropping bins with missing name, or
sorting the variables by their importance, see effect_importance()
-
Except for sort_by
, all arguments are vectorized, i.e., you can
pass a vector or list of the same length as object
.
## S3 method for class 'EffectData'
update(
object,
sort_by = c("no", "pd", "pred_mean", "y_mean", "resid_mean", "ale"),
to_factor = FALSE,
collapse_m = 15L,
collapse_by = c("weight", "N"),
drop_empty = FALSE,
drop_below_n = 0,
drop_below_weight = 0,
na.rm = FALSE,
...
)
object |
Object of class "EffectData". |
sort_by |
By which statistic ("pd", "pred_mean", "y_mean", "resid_mean", "ale") should the results be sorted? The default is "no" (no sorting). Calculated after all other update steps, e.g., after collapsing or dropping rare levels. |
to_factor |
Should discrete features be treated as factors?
In combination with |
collapse_m |
If a factor or character feature has more than |
collapse_by |
How to determine "rare" levels in |
drop_empty |
Drop empty bins. Equivalent to |
drop_below_n |
Drop bins with N below this value. Applied after collapsing. The default is 0. |
drop_below_weight |
Drop bins with weight below this value. Applied after collapsing. The default is 0. |
na.rm |
Should missing bin centers be dropped? Default is |
... |
Currently not used. |
A modified object of class "EffectData".
feature_effects()
, average_observed()
, average_predicted()
,
partial_dependence()
, ale()
, bias()
, effect_importance()
fit <- lm(Sepal.Length ~ ., data = iris)
xvars <- colnames(iris)[-1]
feature_effects(fit, v = xvars, data = iris, y = "Sepal.Length", breaks = 5) |>
update(sort = "pd", collapse_m = 2) |>
plot()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.