jsat.lossfunctions
Class EpsilonInsensitiveLoss
- java.lang.Object
-
- jsat.lossfunctions.EpsilonInsensitiveLoss
-
public class EpsilonInsensitiveLoss extends java.lang.Object implements LossR
The ε-insensitive loss for regression L(x, y) = max(0, |x-y|-ε) is the common loss function used for Support Vector Regression.
When ε = 0, the loss becomes equivalent to theAbsoluteLoss.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description EpsilonInsensitiveLoss(double eps)Creates a new Epsilon Insensitive lossEpsilonInsensitiveLoss(EpsilonInsensitiveLoss toCopy)Copy constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description EpsilonInsensitiveLossclone()static doublederiv(double pred, double y, double eps)Computes the first derivative of the ε-insensitive lossdoublegetConjugate(double b, double pred, double y)Computes the result of the conjugate function of this loss.doublegetDeriv(double pred, double y)Computes the first derivative of the getLoss function.doublegetDeriv2(double pred, double y)Computes the second derivative of the getLoss function.doublegetDeriv2Max()Returns an upper bound on the maximum value of the second derivative.doublegetLoss(double pred, double y)Computes the getLoss for a regression problem.doublegetRegression(double score)Given the score value of a data point, this returns the correct numeric result.doublelipschitz()If this loss is L-Lipschitz (1/L Lipschitz smooth), this method will return the value of L.static doubleloss(double pred, double y, double eps)Computes the ε-insensitive loss
-
-
-
Constructor Detail
-
EpsilonInsensitiveLoss
public EpsilonInsensitiveLoss(double eps)
Creates a new Epsilon Insensitive loss- Parameters:
eps- the epsilon tolerance on error
-
EpsilonInsensitiveLoss
public EpsilonInsensitiveLoss(EpsilonInsensitiveLoss toCopy)
Copy constructor- Parameters:
toCopy- the object to copy
-
-
Method Detail
-
loss
public static double loss(double pred, double y, double eps)Computes the ε-insensitive loss- Parameters:
pred- the predicted valuey- the true valueeps- the epsilon tolerance- Returns:
- the ε-insensitive loss
-
deriv
public static double deriv(double pred, double y, double eps)Computes the first derivative of the ε-insensitive loss- Parameters:
pred- the predicted valuey- the true valueeps- the epsilon tolerance- Returns:
- the first derivative of the ε-insensitive loss
-
getLoss
public double getLoss(double pred, double y)Description copied from interface:LossRComputes the getLoss for a regression problem.
-
getDeriv
public double getDeriv(double pred, double y)Description copied from interface:LossRComputes the first derivative of the getLoss function.
-
getDeriv2
public double getDeriv2(double pred, double y)Description copied from interface:LossRComputes the second derivative of the getLoss function.
-
getConjugate
public double getConjugate(double b, double pred, double y)Description copied from interface:LossFuncComputes the result of the conjugate function of this loss. This function is generally optional, and should returnDouble.NaNif not properly implemented. Many optimization algorithms do require a working implementation though.- Specified by:
getConjugatein interfaceLossFunc- Parameters:
b- the primary input to the functionpred- the predicted score in (-Infinity, Infinity)y- the true class label in {-1, 1}- Returns:
- the result of the conjugate function of this loss
-
getDeriv2Max
public double getDeriv2Max()
Description copied from interface:LossFuncReturns an upper bound on the maximum value of the second derivative. If the second derivative does not exist,Double.NaNis a valid result. It is also possible for0andDouble.POSITIVE_INFINITYto be valid results, and must be checked for.- Specified by:
getDeriv2Maxin interfaceLossFunc- Returns:
- the max value of
LossFunc.getDeriv2(double, double)
-
clone
public EpsilonInsensitiveLoss clone()
-
getRegression
public double getRegression(double score)
Description copied from interface:LossRGiven the score value of a data point, this returns the correct numeric result. For most regression problems this simply returns the score value.- Specified by:
getRegressionin interfaceLossR- Parameters:
score- the score for a data point- Returns:
- the correct numeric regression value for this loss function
-
lipschitz
public double lipschitz()
Description copied from interface:LossFuncIf this loss is L-Lipschitz (1/L Lipschitz smooth), this method will return the value of L. If it is not L-Lipschitz, a value of 0 will be returned.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG