Class LogisticRegressionCostFunction

  • All Implemented Interfaces:
    CostFunction

    public final class LogisticRegressionCostFunction
    extends java.lang.Object
    implements CostFunction
    • Constructor Summary

      Constructors 
      Constructor Description
      LogisticRegressionCostFunction​(de.jungblut.math.DoubleMatrix x, de.jungblut.math.DoubleMatrix y, double lambda)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      CostGradientTuple evaluateCost​(de.jungblut.math.DoubleVector theta)
      Evaluation for the cost function to retrieve cost and gradient.
      • Methods inherited from class java.lang.Object

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

      • LogisticRegressionCostFunction

        public LogisticRegressionCostFunction​(de.jungblut.math.DoubleMatrix x,
                                              de.jungblut.math.DoubleMatrix y,
                                              double lambda)
        Parameters:
        x - normal feature matrix, column 0 should contain the bias.
        y - normal outcome matrix, for multiple classes use the one-hot encoding. This matrix should be transposed.
        lambda - l1 reg parameter.
    • Method Detail

      • evaluateCost

        public CostGradientTuple evaluateCost​(de.jungblut.math.DoubleVector theta)
        Description copied from interface: CostFunction
        Evaluation for the cost function to retrieve cost and gradient.
        Specified by:
        evaluateCost in interface CostFunction
        Parameters:
        theta - a given input vector
        Returns:
        a tuple consists of J (cost) and a vector X which is the gradient of the input.