public class HuberLoss extends Object implements LossR
SquaredLoss
and AbsoluteLoss
loss based on a threshold value.
Constructor and Description |
---|
HuberLoss()
Creates a new HuberLoss loss thresholded at 1
|
HuberLoss(double c)
Creates a new HuberLoss loss
|
Modifier and Type | Method and Description |
---|---|
HuberLoss |
clone() |
static double |
deriv(double pred,
double y,
double c)
Computes the first derivative of the HuberLoss loss
|
static double |
deriv2(double pred,
double y,
double c)
Computes the second derivative of the HuberLoss loss, which only exists for
values <
c |
double |
getDeriv(double pred,
double y)
Computes the first derivative of the getLoss function.
|
double |
getDeriv2(double pred,
double y)
Computes the second derivative of the getLoss function.
|
double |
getDeriv2Max()
Returns an upper bound on the maximum value of the second derivative.
|
double |
getLoss(double pred,
double y)
Computes the getLoss for a regression problem.
|
double |
getRegression(double score)
Given the score value of a data point, this returns the correct numeric
result.
|
static double |
loss(double pred,
double y,
double c)
Computes the HuberLoss loss
|
static double |
regress(double score) |
public HuberLoss(double c)
c
- the threshold to switch between the squared and logistic loss atpublic HuberLoss()
public static double loss(double pred, double y, double c)
pred
- the predicted valuey
- the true valuec
- the threshold valuepublic static double deriv(double pred, double y, double c)
pred
- the predicted valuey
- the true valuec
- the threshold valuepublic static double deriv2(double pred, double y, double c)
c
pred
- the predicted valuey
- the target valuec
- the threshold valuepublic static double regress(double score)
public double getLoss(double pred, double y)
LossR
public double getDeriv(double pred, double y)
LossR
public double getDeriv2(double pred, double y)
LossR
public double getDeriv2Max()
LossFunc
Double.NaN
is a valid
result. It is also possible for 0
and
Double.POSITIVE_INFINITY
to be valid results, and must be checked
for.getDeriv2Max
in interface LossFunc
LossFunc.getDeriv2(double, double)
public HuberLoss clone()
public double getRegression(double score)
LossR
getRegression
in interface LossR
score
- the score for a data pointCopyright © 2017. All rights reserved.