Class LogisticRegressionCostFunction
- java.lang.Object
-
- de.jungblut.classification.regression.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 CostGradientTupleevaluateCost(de.jungblut.math.DoubleVector theta)Evaluation for the cost function to retrieve cost and gradient.
-
-
-
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:CostFunctionEvaluation for the cost function to retrieve cost and gradient.- Specified by:
evaluateCostin interfaceCostFunction- Parameters:
theta- a given input vector- Returns:
- a tuple consists of J (cost) and a vector X which is the gradient of the input.
-
-