# TweedieLoss Class

## Definition

Tweedie loss, based on the log-likelihood of the Tweedie distribution. This loss function is used in Tweedie regression.

public sealed class TweedieLoss : Microsoft.ML.Trainers.ILossFunction<float,float>, Microsoft.ML.Trainers.IRegressionLoss
type TweedieLoss = class
interface IRegressionLoss
interface IScalarLoss
interface ILossFunction<single, single>
Public NotInheritable Class TweedieLoss
Implements ILossFunction(Of Single, Single), IRegressionLoss
Inheritance
TweedieLoss
Implements

## Remarks

The Tweedie Loss function is defined as:

$L(\hat{y}, y, i) = \begin{cases} \hat{y} - y ln(\hat{y}) + ln(\Gamma(y)) & \text{if } i = 1 \\ \hat{y} + \frac{y}{\hat{y}} - \sqrt{y} & \text{if } i = 2 \\ \frac{(\hat{y})^{2 - i}}{2 - i} - y \frac{(\hat{y})^{1 - i}}{1 - i} - (\frac{y^{2 - i}}{2 - i} - y\frac{y^{1 - i}}{1 - i}) & \text{otherwise} \end{cases}$

where $\hat{y}$ is the predicted value, $y$ is the true label, $\Gamma$ is the Gamma function, and $i$ is the index parameter for the Tweedie distribution, in the range [1, 2].

$i$ is set to 1.5 by default. $i = 1$ is Poisson loss, $i = 2$ is gamma loss, and intermediate values are compound Poisson-Gamma loss.

## Constructors

 Constructor for Tweedie loss.