Package gorsat.Regression
Class LogisticRegression
- java.lang.Object
-
- gorsat.Regression.LogisticRegression
-
public abstract class LogisticRegression extends java.lang.ObjectThis program fits a logistic regression model on a given data set. We find the maximum likelihood estimators by using Newton's method to find the zero of the gradient of the likelihood function.
-
-
Field Summary
Fields Modifier and Type Field Description double[]betaprotected double[]deltaprotected intdimprotected double[]gradientprotected double[]gradMultprotected double[][]hessianprotected intmaximumNumberOfSamplesprotected intnumberOfDepVarsintnumberOfIterationsprotected intnumberOfSamplesprotected double[]oneOverprotected double[]proddouble[]pValuesprotected SigmoidFunctionsfdouble[]zStats
-
Constructor Summary
Constructors Modifier Constructor Description protectedLogisticRegression(int numberOfDepVars, int maximumNumberOfSamples)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidcomputeTestStats()static LogisticRegressiongetGorLogisticRegressionObject(int numberOfDepVars, int maximumNumberOfSamples)booleanrunRegression(double[][] x, boolean[] y, int numberOfSamples, double tol, int maxIter)protected abstract voidupdateGradientAndHessian(double[][] x, boolean[] y)protected abstract voidupdateGradientAndHessianFirstRun(double[][] x, boolean[] y)
-
-
-
Field Detail
-
numberOfDepVars
protected final int numberOfDepVars
-
maximumNumberOfSamples
protected final int maximumNumberOfSamples
-
dim
protected final int dim
-
beta
public double[] beta
-
zStats
public double[] zStats
-
pValues
public double[] pValues
-
numberOfIterations
public int numberOfIterations
-
gradient
protected final double[] gradient
-
hessian
protected final double[][] hessian
-
delta
protected final double[] delta
-
numberOfSamples
protected int numberOfSamples
-
oneOver
protected final double[] oneOver
-
gradMult
protected final double[] gradMult
-
prod
protected final double[] prod
-
sf
protected final SigmoidFunction sf
-
-
Method Detail
-
getGorLogisticRegressionObject
public static LogisticRegression getGorLogisticRegressionObject(int numberOfDepVars, int maximumNumberOfSamples)
-
runRegression
public boolean runRegression(double[][] x, boolean[] y, int numberOfSamples, double tol, int maxIter)
-
computeTestStats
protected abstract void computeTestStats()
-
updateGradientAndHessian
protected abstract void updateGradientAndHessian(double[][] x, boolean[] y)
-
updateGradientAndHessianFirstRun
protected abstract void updateGradientAndHessianFirstRun(double[][] x, boolean[] y)
-
-