Class LossMAE

    • Constructor Detail

      • LossMAE

        public LossMAE()
      • LossMAE

        public LossMAE​(INDArray weights)
        Mean Absolute Error loss function where each the output is (optionally) weighted/scaled by a flags scalar value. Note that the weights array must be a row vector, of length equal to the labels/output dimension 1 size. A weight vector of 1s should give identical results to no weight vector.
        Parameters:
        weights - Weights array (row vector). May be null.
    • Method Detail

      • computeScore

        public double computeScore​(INDArray labels,
                                   INDArray preOutput,
                                   IActivation activationFn,
                                   INDArray mask,
                                   boolean average)
        Description copied from interface: ILossFunction
        Compute the score (loss function value) for the given inputs.
        Specified by:
        computeScore in interface ILossFunction
        Overrides:
        computeScore in class LossL1
        Parameters:
        labels - Label/expected preOutput
        preOutput - Output of the model (neural network)
        activationFn - Activation function that should be applied to preOutput
        mask - Mask array; may be null
        average - Whether the score should be averaged (divided by number of rows in labels/preOutput) or not @return Loss function value
      • computeScoreArray

        public INDArray computeScoreArray​(INDArray labels,
                                          INDArray preOutput,
                                          IActivation activationFn,
                                          INDArray mask)
        Description copied from interface: ILossFunction
        Compute the score (loss function value) for each example individually. For input [numExamples,nOut] returns scores as a column vector: [numExamples,1]
        Specified by:
        computeScoreArray in interface ILossFunction
        Overrides:
        computeScoreArray in class LossL1
        Parameters:
        labels - Labels/expected output
        preOutput - Output of the model (neural network)
        activationFn - Activation function that should be applied to preOutput
        Returns:
        Loss function value for each example; column vector
      • computeGradient

        public INDArray computeGradient​(INDArray labels,
                                        INDArray preOutput,
                                        IActivation activationFn,
                                        INDArray mask)
        Description copied from interface: ILossFunction
        Compute the gradient of the loss function with respect to the inputs: dL/dOutput
        Specified by:
        computeGradient in interface ILossFunction
        Overrides:
        computeGradient in class LossL1
        Parameters:
        labels - Label/expected output
        preOutput - Output of the model (neural network), before the activation function is applied
        activationFn - Activation function that should be applied to preOutput
        mask - Mask array; may be null
        Returns:
        Gradient dL/dPreOut