loss {xnet} | R Documentation |
Calculate or extract the loss of a tskrr model
Description
This function allows calculating the loss of a tskrr model using
either one of the functions defined in loss_functions
or a custom user function. If the model inherits from class
tskrrTune
and no additional arguments
are given, the loss is returned for the settings used when tuning.
The function can also be used to extract the original loss from a
permtest
object.
Usage
loss(x, ...)
## S4 method for signature 'tskrr'
loss(
x,
fun = loss_mse,
exclusion = c("interaction", "row", "column", "both"),
replaceby0 = FALSE,
predictions = FALSE,
...
)
## S4 method for signature 'tskrrTune'
loss(
x,
fun = loss_mse,
exclusion = c("interaction", "row", "column", "both"),
replaceby0 = FALSE,
predictions = FALSE,
...
)
## S4 method for signature 'permtest'
loss(x, ...)
Arguments
x |
a model that inherits from class
|
... |
extra arguments passed to the loss function in |
fun |
a function to be used for calculating the loss. This can also be a character value giving the name of one of the loss functions provided in the package |
exclusion |
a character value with possible values "interaction",
"row", "column" or "both".
See also |
replaceby0 |
a logical value indicating whether the interaction
should be simply removed ( |
predictions |
a logical value to indicate whether the
predictions should be used instead of leave one out crossvalidation.
If set to |
Value
a numeric value with the calculated loss
See Also
-
loss_functions
for possible loss functions -
tune
for tuning a model based on loss functions
Examples
data(drugtarget)
mod <- tskrr(drugTargetInteraction, targetSim, drugSim)
loss(mod, fun = loss_auc)
tuned <- tune(mod, fun = loss_auc)
loss(tuned)
loss(tuned, fun = loss_mse)