loss: Calculate or extract the loss of a tskrr model

Description Usage Arguments Value See Also Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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 tskrr

...

extra arguments passed to the loss function in fun.

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 loo for more information.

replaceby0

a logical value indicating whether the interaction should be simply removed (FALSE) or replaced by 0 (TRUE).

predictions

a logical value to indicate whether the predictions should be used instead of leave one out crossvalidation. If set to TRUE, the other arguments are ignored.

Value

a numeric value with the calculated loss

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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)

xnet documentation built on Feb. 4, 2020, 9:10 a.m.