Class Huber
java.lang.Object
org.tribuo.regression.sgd.objectives.Huber
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable
,com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
,SGDObjective<DenseVector>
,RegressionObjective
Huber loss, i.e., a mixture of l2 and l1 losses.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final double
The default cost beyond which the function is linear. -
Constructor Summary
ConstructorDescriptionHuber()
Huber Loss using the default costDEFAULT_COST
.Huber
(double cost) Huber loss using the supplied cost. -
Method Summary
Modifier and TypeMethodDescriptioncom.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance
loss
(DenseVector truth, SGDVector prediction) Deprecated.lossAndGradient
(DenseVector truth, SGDVector prediction) Scores a prediction, returning the loss and a vector of per output dimension gradients.void
Used by the OLCUT configuration system, and should not be called by external code.toString()
-
Field Details
-
DEFAULT_COST
public static final double DEFAULT_COSTThe default cost beyond which the function is linear.- See Also:
-
-
Constructor Details
-
Huber
public Huber()Huber Loss using the default costDEFAULT_COST
. -
Huber
public Huber(double cost) Huber loss using the supplied cost. Cost must be positive.- Parameters:
cost
- The cost.
-
-
Method Details
-
postConfig
public void postConfig()Used by the OLCUT configuration system, and should not be called by external code.- Specified by:
postConfig
in interfacecom.oracle.labs.mlrg.olcut.config.Configurable
-
loss
@Deprecated public com.oracle.labs.mlrg.olcut.util.Pair<Double,SGDVector> loss(DenseVector truth, SGDVector prediction) Deprecated.Description copied from interface:RegressionObjective
Scores a prediction, returning the loss.- Specified by:
loss
in interfaceRegressionObjective
- Parameters:
truth
- The true regression value.prediction
- The predicted regression value.- Returns:
- A pair with the loss and gradient.
-
lossAndGradient
public com.oracle.labs.mlrg.olcut.util.Pair<Double,SGDVector> lossAndGradient(DenseVector 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 interfaceRegressionObjective
- Specified by:
lossAndGradient
in interfaceSGDObjective<DenseVector>
- Parameters:
truth
- The true output.prediction
- The prediction for each dimension.- Returns:
- The score and per dimension gradient.
-
toString
-
getProvenance
public com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance getProvenance()- Specified by:
getProvenance
in interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
-