Class MaskedSoftmaxCrossEntropyLoss


  • public class MaskedSoftmaxCrossEntropyLoss
    extends Loss
    MaskedSoftmaxCrossEntropyLoss is an implementation of Loss that only considers a specific number of values for the loss computations, and masks the rest according to the given sequence.
    • Constructor Detail

      • MaskedSoftmaxCrossEntropyLoss

        public MaskedSoftmaxCrossEntropyLoss()
        Creates a new instance of SoftmaxCrossEntropyLoss with default parameters.
      • MaskedSoftmaxCrossEntropyLoss

        public MaskedSoftmaxCrossEntropyLoss​(java.lang.String name)
        Creates a new instance of SoftmaxCrossEntropyLoss with default parameters.
        Parameters:
        name - the name of the loss
      • MaskedSoftmaxCrossEntropyLoss

        public MaskedSoftmaxCrossEntropyLoss​(java.lang.String name,
                                             float weight,
                                             int classAxis,
                                             boolean sparseLabel,
                                             boolean fromLogit)
        Creates a new instance of MaskedSoftmaxCrossEntropyLoss with the given parameters.
        Parameters:
        name - the name of the loss
        weight - the weight to apply on the loss value, default 1
        classAxis - the axis that represents the class probabilities, default -1
        sparseLabel - whether labels are integer array or probabilities, default true
        fromLogit - whether predictions are log probabilities or un-normalized numbers, default false
    • Method Detail

      • evaluate

        public NDArray evaluate​(NDList labels,
                                NDList predictions)
        Calculates the evaluation between the labels and the predictions. The label parameter is an NDList that contains the label and the mask sequence in that order.
        Specified by:
        evaluate in class Evaluator
        Parameters:
        labels - the NDList that contains correct values and the mask sequence
        predictions - the predicted values
        Returns:
        the evaluation result