public class HingeLoss extends Object implements LossMC
Constructor and Description |
---|
HingeLoss() |
Modifier and Type | Method and Description |
---|---|
static CategoricalResults |
classify(double score) |
HingeLoss |
clone() |
static double |
deriv(double pred,
double y)
Computes the first derivative of the HingeLoss loss
|
void |
deriv(Vec processed,
Vec derivs,
int y)
Computes the derivatives with respect to each output
processed and derivs may be the same object, and will
simply have all its values altered if so. |
CategoricalResults |
getClassification(double score)
Given the score value of a data point, this returns the classification
results.
|
CategoricalResults |
getClassification(Vec processed)
Given the
processed
predictions, returns the classification results for said predictions. |
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 classification problem.
|
double |
getLoss(Vec processed,
int y)
Computes the scalar loss for on the given example
|
static double |
loss(double pred,
double y)
Computes the HingeLoss loss
|
void |
process(Vec pred,
Vec processed)
Given the vector of raw outputs for each class, transform it into a new
vector.
|
public static double loss(double pred, double y)
pred
- the predicted valuey
- the target valuepublic static double deriv(double pred, double y)
pred
- the predicted valuey
- the target valuepublic static CategoricalResults classify(double score)
public double getLoss(double pred, double y)
LossC
public double getDeriv(double pred, double y)
LossC
public double getDeriv2(double pred, double y)
LossC
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 HingeLoss clone()
public CategoricalResults getClassification(double score)
LossC
getClassification
in interface LossC
score
- the score for a data pointpublic double getLoss(Vec processed, int y)
LossMC
public void process(Vec pred, Vec processed)
LossMC
processed
and derivs
may be the same object, and will
simply have all its values altered if so.public void deriv(Vec processed, Vec derivs, int y)
LossMC
processed
and derivs
may be the same object, and will
simply have all its values altered if so.public CategoricalResults getClassification(Vec processed)
LossMC
processed
predictions, returns the classification results for said predictions.getClassification
in interface LossMC
processed
- the processed score/prediction vectorCopyright © 2017. All rights reserved.