MultiLoss¶
- class pytorch_forecasting.metrics.MultiLoss(metrics: List[torchmetrics.metric.Metric], weights: Optional[List[float]] = None)[source]¶
Bases:
torchmetrics.metric.Metric
Metric that can be used with muliple metrics.
- Parameters
metrics (List[LightningMetric], optional) – list of metrics to combine.
weights (List[float], optional) – list of weights / multipliers for weights. Defaults to 1.0 for all metrics.
Methods
compute
()Get metric
to_prediction
(y_pred, **kwargs)Convert network prediction into a point prediction.
to_quantiles
(y_pred, **kwargs)Convert network prediction into a quantile prediction.
update
(y_pred, y_actual)Update composite metric
- to_prediction(y_pred: torch.Tensor, **kwargs) torch.Tensor [source]¶
Convert network prediction into a point prediction.
Will use first metric in
metrics
attribute to calculate result.- Parameters
y_pred – prediction output of network
**kwargs – arguments for metrics
- Returns
point prediction
- Return type
torch.Tensor
- to_quantiles(y_pred: torch.Tensor, **kwargs) torch.Tensor [source]¶
Convert network prediction into a quantile prediction.
Will use first metric in
metrics
attribute to calculate result.- Parameters
y_pred – prediction output of network
**kwargs – parameters to each metric’s
to_quantiles()
method
- Returns
prediction quantiles
- Return type
torch.Tensor