Class LossFunctions

java.lang.Object
com.jml.losses.LossFunctions

public class LossFunctions extends Object
This class contains lambda functions for various loss functions including:
     - sse: sum of squared-errors loss.
     - binCrossEntropy: binary cross-entropy loss (Cross-entropy for two classes).
     - crossEntropy: cross-entropy loss (For multiple classes).
 
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static Function
    The binary cross-entropy loss function.
    static Function
    the cross-entropy loss function.
    static Function
    The sum of mean squared-errors loss function.
    That is mse = (1/n)*sum(xi - yi)2 where x and y are datasets of length n, and x is the actual data and y is the predicted data.
    static Function
    The sum of squared-errors loss function.
    That is sse = sum(xi - yi)2 where x and y are datasets of length n, and x is the actual data and y is the predicted data.
  • Method Summary

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • mse

      public static final Function mse
      The sum of mean squared-errors loss function.
      That is mse = (1/n)*sum(xi - yi)2 where x and y are datasets of length n, and x is the actual data and y is the predicted data.
    • sse

      public static final Function sse
      The sum of squared-errors loss function.
      That is sse = sum(xi - yi)2 where x and y are datasets of length n, and x is the actual data and y is the predicted data.
    • binCrossEntropy

      public static final Function binCrossEntropy
      The binary cross-entropy loss function. Note: cross-entropy is undefined for p=0 or p=1, so probabilities adjusted to be "very close" to 0 or 1 if appropriate.
    • crossEntropy

      public static final Function crossEntropy
      the cross-entropy loss function. Note: cross-entropy is undefined for p=0 or p=1, so probabilities adjusted to be "very close" to 0 or 1 if appropriate.