Tweedie Class

Some of the trainers accept a loss parameter that will be used for training. It is also known as loss function, objective function, or optimization score function.

Inheritance
builtins.object
Tweedie

Constructor

Tweedie(index=1.5)

Parameters

Name Description
index

Index parameter for the Tweedie distribution, in the range [1, 2]. 1 is Poisson loss, 2 is gamma loss, and intermediate values are compound Poisson loss.

Examples


   ###############################################################################
   # Tweedie Loss
   from nimbusml.linear_model import OnlineGradientDescentRegressor
   # can also use loss class instead of string
   from nimbusml.loss import Tweedie

   # specifying the loss function as a string keyword
   trainer1 = OnlineGradientDescentRegressor(loss='tweedie')

   trainer2 = OnlineGradientDescentRegressor(
       loss=Tweedie())  # equivalent to loss='tweedie'
   trainer3 = OnlineGradientDescentRegressor(loss=Tweedie(index=3.0))

Remarks

Losses can be specified either as a string or a loss object. When loss is specified as one of these strings, the default values are used for the loss parameters. To change the default parameters, a loss object should be used, as seen in examples below.

Each trainer supports only a subset of the losses mentioned above. To get the supported losses and the default loss, please refer to the documentation page for the specific trainer.

The Tweedie loss for regression. Assuming that the response variable y follows Tweedie distribution, maximum likelihood is used to estimate the parameters by maximuzing the probability of obtaining the observed data. Its string name is 'tweedie'.

It can be used for OnlineGradientDescentRegressor.