pytorch_forecasting.metrics.
MultiHorizonMetric
Bases: pytorch_forecasting.metrics.Metric
pytorch_forecasting.metrics.Metric
Abstract class for defining metric for a multihorizon forecast
Initialize metric
name (str) – metric name. Defaults to class name.
quantiles (List[float], optional) – quantiles for probability range. Defaults to None.
reduction (str, optional) – Reduction, “none”, “mean” or “sqrt-mean”. Defaults to “mean”.
Methods
compute()
compute
Abstract method that calcualtes metric
loss(y_pred, target)
loss
Calculate loss without reduction.
mask_losses(losses, lengths[, reduction])
mask_losses
Mask losses.
reduce_loss(losses, lengths[, reduction])
reduce_loss
Reduce loss.
update(y_pred, target)
update
Update method of metric that handles masking of values.
Should be overriden in derived classes
y_pred – network output
y_actual – actual values
metric value on which backpropagation can be applied
torch.Tensor
Calculate loss without reduction. Override in derived classes
loss/metric as a single number for backpropagation
losses (torch.Tensor) – total loss. first dimenion are samples, second timesteps
lengths (torch.Tensor) – total length
reduction (str, optional) – type of reduction. Defaults to self.reduction.
self.reduction
masked losses
reduced loss
Do not override this method but loss() instead
loss()
y_pred (Dict[str, torch.Tensor]) – network output
target (Union[torch.Tensor, rnn.PackedSequence]) – actual values
loss as a single number for backpropagation