public class SoftmaxCrossEntropyLoss extends Loss
SoftmaxCrossEntropyLoss is a type of Loss that calculates the softmax cross
entropy loss.
If sparse_label is true (default), label should contain integer
category indicators. Then, \(L = -\sum_i \log p_{i, label_i}\). If sparse_label is false, label should contain probability distribution and its shape should be the same as
the shape of prediction. Then, \(L = -\sum_i \sum_j {label}_j \log p_{ij}\).
totalInstances| Constructor and Description |
|---|
SoftmaxCrossEntropyLoss()
Creates a new instance of
SoftmaxCrossEntropyLoss with default parameters. |
SoftmaxCrossEntropyLoss(java.lang.String name)
Creates a new instance of
SoftmaxCrossEntropyLoss with default parameters. |
SoftmaxCrossEntropyLoss(java.lang.String name,
float weight,
int classAxis,
boolean sparseLabel,
boolean fromLogit)
Creates a new instance of
SoftmaxCrossEntropyLoss with the given parameters. |
| Modifier and Type | Method and Description |
|---|---|
NDArray |
evaluate(NDList label,
NDList prediction)
Calculates the evaluation between the labels and the predictions.
|
addAccumulator, getAccumulator, hingeLoss, hingeLoss, hingeLoss, l1Loss, l1Loss, l1Loss, l2Loss, l2Loss, l2Loss, resetAccumulator, sigmoidBinaryCrossEntropyLoss, sigmoidBinaryCrossEntropyLoss, sigmoidBinaryCrossEntropyLoss, softmaxCrossEntropyLoss, softmaxCrossEntropyLoss, softmaxCrossEntropyLoss, updateAccumulatorcheckLabelShapes, checkLabelShapes, getNamepublic SoftmaxCrossEntropyLoss()
SoftmaxCrossEntropyLoss with default parameters.public SoftmaxCrossEntropyLoss(java.lang.String name)
SoftmaxCrossEntropyLoss with default parameters.name - the name of the losspublic SoftmaxCrossEntropyLoss(java.lang.String name,
float weight,
int classAxis,
boolean sparseLabel,
boolean fromLogit)
SoftmaxCrossEntropyLoss with the given parameters.name - the name of the lossweight - the weight to apply on the loss value, default 1classAxis - the axis that represents the class probabilities, default -1sparseLabel - whether labels are integer array or probabilities, default truefromLogit - whether labels are log probabilities or un-normalized numbers