Enum LossReduce

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      MEAN_BY_NONZERO_WEIGHT_COUNT
      Weighted mean: sum(weights * perOutputLoss) / count(weights != 0)
      Example: 2d input, mean squared error loss.
      Output: squared_error_per_ex = weights * squaredDifference(predictions,labels)
      output = sum(squared_error_per_ex) / count(weights != 0)
      NOTE: if weights array is not provided, then weights default to scalar 1.0 and hence MEAN_BY_NONZERO_WEIGHT_COUNT is equivalent to MEAN_BY_WEIGHT
      MEAN_BY_WEIGHT
      Weighted mean: sum(weights * perOutputLoss) / sum(weights) - gives a single scalar output
      Example: 2d input, mean squared error
      Output: squared_error_per_ex = weights * squaredDifference(predictions,labels)
      output = sum(squared_error_per_ex) / sum(weights)

      NOTE: if weights array is not provided, then weights default to 1.0 for all entries - and hence MEAN_BY_WEIGHT is equivalent to MEAN_BY_NONZERO_WEIGHT_COUNT
      NONE
      No reduction.
      SUM
      Weigted sum across all loss values, returning a scalar.
    • Enum Constant Detail

      • NONE

        public static final LossReduce NONE
        No reduction. In most cases, output is the same shape as the predictions/labels.
        Weights (if any) are applied
        Example Input: 2d input array with mean squared error loss.
        Example Output: squaredDifference(predictions,labels), with same shape as input/labels
      • SUM

        public static final LossReduce SUM
        Weigted sum across all loss values, returning a scalar.
      • MEAN_BY_WEIGHT

        public static final LossReduce MEAN_BY_WEIGHT
        Weighted mean: sum(weights * perOutputLoss) / sum(weights) - gives a single scalar output
        Example: 2d input, mean squared error
        Output: squared_error_per_ex = weights * squaredDifference(predictions,labels)
        output = sum(squared_error_per_ex) / sum(weights)

        NOTE: if weights array is not provided, then weights default to 1.0 for all entries - and hence MEAN_BY_WEIGHT is equivalent to MEAN_BY_NONZERO_WEIGHT_COUNT
      • MEAN_BY_NONZERO_WEIGHT_COUNT

        public static final LossReduce MEAN_BY_NONZERO_WEIGHT_COUNT
        Weighted mean: sum(weights * perOutputLoss) / count(weights != 0)
        Example: 2d input, mean squared error loss.
        Output: squared_error_per_ex = weights * squaredDifference(predictions,labels)
        output = sum(squared_error_per_ex) / count(weights != 0)
        NOTE: if weights array is not provided, then weights default to scalar 1.0 and hence MEAN_BY_NONZERO_WEIGHT_COUNT is equivalent to MEAN_BY_WEIGHT
    • Method Detail

      • values

        public static LossReduce[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (LossReduce c : LossReduce.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static LossReduce valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null