Class Hinge
java.lang.Object
org.tribuo.classification.sgd.objectives.Hinge
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable
,com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
,LabelObjective
Hinge loss, scores the correct value margin and any incorrect predictions -margin.
By default the margin is 1.0.
The Hinge loss does not generate a probabilistic model, and uses a NoopNormalizer
.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a newNoopNormalizer
.com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance
boolean
Returns false.toString()
valueAndGradient
(int truth, SGDVector prediction) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfig
-
Constructor Details
-
Hinge
Construct a hinge objective with the supplied margin.- Parameters:
margin
- The margin to use.
-
Hinge
public Hinge()Construct a hinge objective with a margin of 1.0.
-
-
Method Details
-
valueAndGradient
public com.oracle.labs.mlrg.olcut.util.Pair<Double, SGDVector> valueAndGradient(int truth, SGDVector prediction) - Specified by:
valueAndGradient
in interfaceLabelObjective
- Parameters:
truth
- The true label id.prediction
- The prediction for each label id.- Returns:
- The loss and per label gradient.
-
getNormalizer
Returns a newNoopNormalizer
.- Specified by:
getNormalizer
in interfaceLabelObjective
- Returns:
- The vector normalizer.
-
isProbabilistic
Returns false.- Specified by:
isProbabilistic
in interfaceLabelObjective
- Returns:
- False.
-
toString
-
getProvenance
- Specified by:
getProvenance
in interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
-