Calculates performance of a flashlight with respect to one or more performance measure.
light_performance(x, ...)
# Default S3 method
light_performance(x, ...)
# S3 method for class 'flashlight'
light_performance(
x,
data = x$data,
by = x$by,
metrics = x$metrics,
use_linkinv = FALSE,
...
)
# S3 method for class 'multiflashlight'
light_performance(x, ...)
An object of class "flashlight" or "multiflashlight".
Arguments passed from or to other functions.
An optional data.frame
.
An optional vector of column names used to additionally group the results.
Will overwrite x$by
.
An optional named list with metrics. Each metric takes at least
four arguments: actual, predicted, case weights w and ...
.
Should retransformation function be applied? Default is FALSE
.
An object of class "light_performance" with the following elements:
data
: A tibble containing the results.
by
Same as input by
.
The minimal required elements in the (multi-) flashlight are "y", "predict_function",
"model", "data" and "metrics". The latter two can also directly be passed to
light_performance()
. Note that by default, no retransformation function is applied.
light_performance(default)
: Default method not implemented yet.
light_performance(flashlight)
: Model performance of flashlight object.
light_performance(multiflashlight)
: Model performance of multiflashlight object.
fit_part <- lm(Sepal.Length ~ Species + Petal.Length, data = iris)
fl_part <- flashlight(
model = fit_part, label = "part", data = iris, y = "Sepal.Length"
)
plot(light_performance(fl_part, by = "Species"), fill = "chartreuse4")
# Second model
fit_full <- lm(Sepal.Length ~ ., data = iris)
fl_full <- flashlight(
model = fit_full, label = "full", data = iris, y = "Sepal.Length"
)
fls <- multiflashlight(list(fl_part, fl_full))
plot(light_performance(fls, by = "Species"))
plot(light_performance(fls, by = "Species"), swap_dim = TRUE)