TweedieLoss#
- class pytorch_forecasting.metrics.point.TweedieLoss(reduction='mean', p: float = 1.5, **kwargs)[source]#
Bases:
pytorch_forecasting.metrics.base_metrics.MultiHorizonMetricTweedie loss
Tweedie regression with log-link. It might be useful, e.g., for modeling total loss in insurance, or for any target that might be tweedie-distributed.
- Parameters
p (float, optional) – tweedie variance power which is greater equal 1.0 and smaller 2.0. Close to
2shifts to Gamma distribution and close to1shifts to Poisson distribution. Defaults to 1.5.reduction (str, optional) – How to reduce the loss. Defaults to “mean”.
Methods
loss(y_pred, y_true)Calculate loss without reduction.
to_prediction(out)Convert network prediction into a point prediction.