Hinge 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
Hinge

Constructor

Hinge(margin=1.0)

Parameters

margin

Margin value

Examples


   ###############################################################################
   # Hinge Loss
   from nimbusml.linear_model import AveragedPerceptronBinaryClassifier
   from nimbusml.loss import Hinge

   # specify the loss function as a string keyword
   trainer1 = AveragedPerceptronBinaryClassifier(loss='hinge')

   # can also use the loss class instead of string

   trainer1 = AveragedPerceptronBinaryClassifier(
       loss=Hinge())  # equivalent to loss='hinge'
   trainer2 = AveragedPerceptronBinaryClassifier(loss=Hinge(margin=2.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 Hinge loss for classification. Its string name is 'hinge'.

It can be used for AveragedPerceptronBinaryClassifier, FastLinearBinaryClassifier, FastLinearClassifier, SgdBinaryClassifier.