Documentation of 'jsat.lossfunctions.LogisticLoss' Java class
LogisticLoss
jsat.lossfunctions

Class LogisticLoss

  • All Implemented Interfaces:
    java.io.Serializable, LossC, LossFunc
    Direct Known Subclasses:
    SoftmaxLoss


    public class LogisticLoss
    extends java.lang.Object
    implements LossC
    The LogisticLoss loss function for classification L(x, y) = log(1+exp(-y*x)).
    This function is twice differentiable.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      LogisticLoss() 
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      static CategoricalResults classify(double score) 
      LogisticLoss clone() 
      static double deriv(double pred, double y)
      Computes the first derivative of the logistic loss
      static double deriv2(double pred, double y)
      Computes the second derivative of the logistic loss
      CategoricalResults getClassification(double score)
      Given the score value of a data point, this returns the classification results.
      double getConjugate(double b, double pred, double y)
      Computes the result of the conjugate function of this loss.
      double getDeriv(double pred, double y)
      Computes the first derivative of the getLoss function.
      double getDeriv2(double pred, double y)
      Computes the second derivative of the getLoss function.
      double getDeriv2Max()
      Returns an upper bound on the maximum value of the second derivative.
      double getLoss(double pred, double y)
      Computes the getLoss for a classification problem.
      double lipschitz()
      If this loss is L-Lipschitz (1/L Lipschitz smooth), this method will return the value of L.
      static double loss(double pred, double y)
      Computes the logistic loss
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LogisticLoss

        public LogisticLoss()
    • Method Detail

      • loss

        public static double loss(double pred,
                                  double y)
        Computes the logistic loss
        Parameters:
        pred - the predicted value
        y - the true value
        Returns:
        the logistic loss
      • deriv

        public static double deriv(double pred,
                                   double y)
        Computes the first derivative of the logistic loss
        Parameters:
        pred - the predicted value
        y - the true value
        Returns:
        the first derivative of the logistic loss
      • deriv2

        public static double deriv2(double pred,
                                    double y)
        Computes the second derivative of the logistic loss
        Parameters:
        pred - the predicted value
        y - the true value
        Returns:
        the second derivative of the logistic loss
      • getLoss

        public double getLoss(double pred,
                              double y)
        Description copied from interface: LossC
        Computes the getLoss for a classification problem.
        Specified by:
        getLoss in interface LossC
        Specified by:
        getLoss in interface LossFunc
        Parameters:
        pred - the predicted score in (-Infinity, Infinity)
        y - the true class label in {-1, 1}
        Returns:
        the getLoss in [0, Inf)
      • getDeriv

        public double getDeriv(double pred,
                               double y)
        Description copied from interface: LossC
        Computes the first derivative of the getLoss function.
        Specified by:
        getDeriv in interface LossC
        Specified by:
        getDeriv in interface LossFunc
        Parameters:
        pred - the predicted score in (-Infinity, Infinity)
        y - the true class label in {-1, 1}
        Returns:
        the first derivative of the getLoss
      • getDeriv2

        public double getDeriv2(double pred,
                                double y)
        Description copied from interface: LossC
        Computes the second derivative of the getLoss function.
        Specified by:
        getDeriv2 in interface LossC
        Specified by:
        getDeriv2 in interface LossFunc
        Parameters:
        pred - the predicted score in (-Infinity, Infinity)
        y - the true class label in {-1, 1}
        Returns:
        the second derivative of the getLoss function
      • getDeriv2Max

        public double getDeriv2Max()
        Description copied from interface: LossFunc
        Returns an upper bound on the maximum value of the second derivative. If the second derivative does not exist, Double.NaN is a valid result. It is also possible for 0 and Double.POSITIVE_INFINITY to be valid results, and must be checked for.
        Specified by:
        getDeriv2Max in interface LossFunc
        Returns:
        the max value of LossFunc.getDeriv2(double, double)
      • getClassification

        public CategoricalResults getClassification(double score)
        Description copied from interface: LossC
        Given the score value of a data point, this returns the classification results.
        Specified by:
        getClassification in interface LossC
        Parameters:
        score - the score for a data point
        Returns:
        the categorical results with the correct probability values for this loss function.
      • getConjugate

        public double getConjugate(double b,
                                   double pred,
                                   double y)
        Description copied from interface: LossFunc
        Computes the result of the conjugate function of this loss. This function is generally optional, and should return Double.NaN if not properly implemented. Many optimization algorithms do require a working implementation though.
        Specified by:
        getConjugate in interface LossFunc
        Parameters:
        b - the primary input to the function
        pred - the predicted score in (-Infinity, Infinity)
        y - the true class label in {-1, 1}
        Returns:
        the result of the conjugate function of this loss
      • lipschitz

        public double lipschitz()
        Description copied from interface: LossFunc
        If this loss is L-Lipschitz (1/L Lipschitz smooth), this method will return the value of L. If it is not L-Lipschitz, a value of 0 will be returned.
        Specified by:
        lipschitz in interface LossFunc
        Returns:
        the L-Lipschitz constant, or 0 if this loss is not L-Lipschitz;

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.