The
function loss
computes the sequence of instantaneous losses suffered
by the predictions in x
to predict the observation in y
.
loss(
x,
y,
pred = NULL,
loss.type = list(name = "square"),
loss.gradient = FALSE
)
numeric
. A vector of length T
containing the sequence of prediction to be evaluated.
numeric
. A vector of length T
that contains the observations to be predicted.
numeric
. A vector of length T
containing the sequence of real values.
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.
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).
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).