Package org.tribuo.common.sgd
Interface SGDObjective<T>
- Type Parameters:
T
- The type of the output at training time.
- All Superinterfaces:
com.oracle.labs.mlrg.olcut.config.Configurable
,com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
- All Known Subinterfaces:
LabelObjective
,MultiLabelObjective
,RegressionObjective
- All Known Implementing Classes:
AbsoluteLoss
,BinaryCrossEntropy
,Hinge
,Hinge
,Huber
,LogMulticlass
,SquaredLoss
public interface SGDObjective<T>
extends com.oracle.labs.mlrg.olcut.config.Configurable, com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
An interface for a loss function that can produce the loss and gradient incurred by
a single prediction.
-
Method Summary
Modifier and TypeMethodDescriptionlossAndGradient
(T truth, SGDVector prediction) Scores a prediction, returning the loss and a vector of per output dimension gradients.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
-
lossAndGradient
com.oracle.labs.mlrg.olcut.util.Pair<Double,SGDVector> lossAndGradient(T truth, SGDVector prediction) Scores a prediction, returning the loss and a vector of per output dimension gradients.- Parameters:
truth
- The true output.prediction
- The prediction for each dimension.- Returns:
- The score and per dimension gradient.
-