Package org.tribuo.classification.sgd
Interface LabelObjective
- All Superinterfaces:
com.oracle.labs.mlrg.olcut.config.Configurable
,com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
,SGDObjective<Integer>
- All Known Implementing Classes:
Hinge
,LogMulticlass
An interface for single label prediction objectives.
An objective knows if it generates a probabilistic model or not, and what kind of normalization needs to be applied to produce probability values.
-
Method Summary
Modifier and TypeMethodDescriptionGenerates a newVectorNormalizer
which normalizes the predictions into [0,1].boolean
Does the objective function score probabilities or not?lossAndGradient
(Integer truth, SGDVector prediction) Scores a prediction, returning the loss and a vector of per output dimension gradients.valueAndGradient
(int truth, SGDVector prediction) Deprecated.Methods inherited from interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfig
Methods inherited from interface com.oracle.labs.mlrg.olcut.provenance.Provenancable
getProvenance
-
Method Details
-
valueAndGradient
@Deprecated com.oracle.labs.mlrg.olcut.util.Pair<Double,SGDVector> valueAndGradient(int truth, SGDVector prediction) Deprecated.In 4.1, to migrate to the new namelossAndGradient(java.lang.Integer, org.tribuo.math.la.SGDVector)
.Scores a prediction, returning the loss and a vector of per label gradients.- Parameters:
truth
- The true label id.prediction
- The prediction for each label id.- Returns:
- The score and per label gradient.
-
lossAndGradient
default com.oracle.labs.mlrg.olcut.util.Pair<Double,SGDVector> lossAndGradient(Integer truth, SGDVector prediction) Description copied from interface:SGDObjective
Scores a prediction, returning the loss and a vector of per output dimension gradients.- Specified by:
lossAndGradient
in interfaceSGDObjective<Integer>
- Parameters:
truth
- The true output.prediction
- The prediction for each dimension.- Returns:
- The score and per dimension gradient.
-
getNormalizer
VectorNormalizer getNormalizer()Generates a newVectorNormalizer
which normalizes the predictions into [0,1].- Returns:
- The vector normalizer for this objective.
-
isProbabilistic
boolean isProbabilistic()Does the objective function score probabilities or not?- Returns:
- boolean.
-
lossAndGradient(java.lang.Integer, org.tribuo.math.la.SGDVector)
.