loss: Errors suffered by a sequence of predictions

View source: R/loss.R

lossR Documentation

Errors suffered by a sequence of predictions

Description

The function loss computes the sequence of instantaneous losses suffered by the predictions in x to predict the observation in y.

Usage

loss(
  x,
  y,
  pred = NULL,
  loss.type = list(name = "square"),
  loss.gradient = FALSE
)

Arguments

x

numeric. A vector of length T containing the sequence of predictions to be evaluated.

y

numeric. A vector of length T that contains the observations to be predicted.

pred

numeric. A vector of length T containing the sequence of real values.

loss.type

character, list or function ("square").

character

Name of the loss to be applied ("square", "absolute", "percentage", or "pinball").

list

List with field name equal to the loss name. If using pinball loss, field tau specifies the quantile in [0,1].

function

A custom loss function of two parameters.

loss.gradient

boolean, function (TRUE).

boolean

If TRUE, the aggregation rule will not be directly applied to the loss function, but to a gradient version of it, similar to a gradient descent aggregation rule.

function

If loss.type is a function, provide the derivative to be used (not computed automatically).

Value

A vector of length T containing the sequence of instantaneous losses suffered by the expert predictions (x) or the gradient computed on the aggregated predictions (pred).

Author(s)

Pierre Gaillard <pierre.gaillard@inria.fr>


Dralliag/opera documentation built on Nov. 10, 2024, 10:29 a.m.