flashlight | R Documentation |
Creates or updates a "flashlight" object. If a flashlight is to be created,
all arguments are optional except label
. If a flashlight is to be updated,
all arguments are optional up to x
(the flashlight to be updated).
flashlight(x, ...)
## Default S3 method:
flashlight(
x,
model = NULL,
data = NULL,
y = NULL,
predict_function = stats::predict,
linkinv = function(z) z,
w = NULL,
by = NULL,
metrics = list(rmse = MetricsWeighted::rmse),
label = NULL,
shap = NULL,
...
)
## S3 method for class 'flashlight'
flashlight(x, check = TRUE, ...)
x |
An object of class "flashlight". If not provided, a new flashlight is
created based on further input. Otherwise, |
... |
Arguments passed from or to other functions. |
model |
A fitted model of any type. Most models require a customized
|
data |
A |
y |
Variable name of response. |
predict_function |
A real valued function with two arguments:
A model and a data of the same structure as |
linkinv |
An inverse transformation function applied after |
w |
A variable name of case weights. |
by |
A character vector with names of grouping variables. |
metrics |
A named list of metrics. Here, a metric is a function with exactly
four arguments: actual, predicted, w (case weights) and |
label |
Name of the flashlight. Required. |
shap |
An optional shap object. Typically added by calling |
check |
When updating the flashlight: Should internal checks be performed?
Default is |
An object of class "flashlight" (and list
) containing each
input (except x
) as element.
flashlight(default)
: Used to create a flashlight object.
No x
has to be passed in this case.
flashlight(flashlight)
: Used to update an existing flashlight object.
multiflashlight()
fit <- lm(Sepal.Length ~ ., data = iris)
(fl <- flashlight(model = fit, data = iris, y = "Sepal.Length", label = "ols"))
(fl_updated <- flashlight(fl, linkinv = exp))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.