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 predictions 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").
Name of the loss to be applied ("square", "absolute", "percentage", or "pinball").
List with field name equal to the loss name. If using pinball loss, field tau
specifies the quantile in [0,1].
A custom loss function of two parameters.
boolean, function (TRUE).
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.
If loss.type is a function, provide the derivative to be used (not computed automatically).
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).