loss: Errors suffered by a sequence of predictions

Description Usage Arguments Value Author(s)

View source: R/loss.R

Description

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

Usage

1
2
3
4
5
6
7
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 prediction 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 equal to the required quantile in [0,1];

  • function A custom loss as a function of two parameters.

loss.gradient

boolean, function (TRUE).

  • boolean If TRUE, the aggregation rule will not be directly applied to the loss function at hand, but to a gradient version of it. The aggregation rule is then similar to gradient descent aggregation rule.

  • function If loss.type is a function, the derivative should be provided to be used (it is not automatically computed).

Value

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

Author(s)

Pierre Gaillard <pierre@gaillard.me>


opera documentation built on Dec. 11, 2021, 9:07 a.m.