jsat.lossfunctions
Interface LossMC
-
- All Known Implementing Classes:
- HingeLoss, SoftmaxLoss
public interface LossMC extends LossC
Specifies a loss function for multi-class problems. A multi-class loss function must support a raw vector of scores for each class, where positive values indicate preference for the class associated with the same index.
Callingprocess(jsat.linear.Vec, jsat.linear.Vec)on the raw scores is a mandatory first step, and will transform the raw scores into a usable form for the loss function.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description voidderiv(Vec processed, Vec derivs, int y)Computes the derivatives with respect to each output
processedandderivsmay be the same object, and will simply have all its values altered if so.CategoricalResultsgetClassification(Vec processed)Given theprocessedpredictions, returns the classification results for said predictions.doublegetLoss(Vec processed, int y)Computes the scalar loss for on the given examplevoidprocess(Vec pred, Vec processed)Given the vector of raw outputs for each class, transform it into a new vector.-
Methods inherited from interface jsat.lossfunctions.LossC
clone, getClassification, getDeriv, getDeriv2, getLoss
-
Methods inherited from interface jsat.lossfunctions.LossFunc
getConjugate, getDeriv2Max, lipschitz
-
-
-
-
Method Detail
-
getLoss
double getLoss(Vec processed, int y)
Computes the scalar loss for on the given example- Parameters:
processed- the vector of raw predictions.y- the true class label in [0, k-1] for k classes- Returns:
- the loss in [0, Inf)
-
process
void process(Vec pred, Vec processed)
Given the vector of raw outputs for each class, transform it into a new vector.
processedandderivsmay be the same object, and will simply have all its values altered if so.- Parameters:
pred- the vector of raw predictionsprocessed- the location to store the processed predictions.
-
deriv
void deriv(Vec processed, Vec derivs, int y)
Computes the derivatives with respect to each output
processedandderivsmay be the same object, and will simply have all its values altered if so.- Parameters:
processed- the processed predictionsderivs- the vector to place the derivative of the loss to.y- the true class label in [0, k-1] for k classes
-
getClassification
CategoricalResults getClassification(Vec processed)
Given theprocessedpredictions, returns the classification results for said predictions.- Parameters:
processed- the processed score/prediction vector- Returns:
- the classification results
-
-
DataMelt 3.0 © DataMelt by jWork.ORG