Class LogisticRegression
- java.lang.Object
-
- de.jungblut.classification.AbstractPredictor
-
- de.jungblut.classification.AbstractClassifier
-
- de.jungblut.classification.regression.LogisticRegression
-
- All Implemented Interfaces:
Classifier,Predictor
public final class LogisticRegression extends AbstractClassifier
-
-
Constructor Summary
Constructors Constructor Description LogisticRegression(double lambda, Minimizer minimizer, int numIterations, boolean verbose)Creates a new logistic regression.LogisticRegression(de.jungblut.math.DoubleVector theta)Creates a new logistic regression by already existing parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description de.jungblut.math.DoubleVectorgetTheta()de.jungblut.math.DoubleVectorpredict(de.jungblut.math.DoubleVector features)Classifies the given features.voidtrain(de.jungblut.math.DoubleVector[] features, de.jungblut.math.DoubleVector[] outcome)Trains this classifier with the given features and the outcome.-
Methods inherited from class de.jungblut.classification.AbstractClassifier
train
-
Methods inherited from class de.jungblut.classification.AbstractPredictor
extractPredictedClass, extractPredictedClass, predictedClass, predictedClass, predictProbability
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.jungblut.classification.Predictor
asClassifier, extractPredictedClass, extractPredictedClass, predictedClass, predictedClass, predictProbability
-
-
-
-
Constructor Detail
-
LogisticRegression
public LogisticRegression(double lambda, Minimizer minimizer, int numIterations, boolean verbose)Creates a new logistic regression.- Parameters:
lambda- the regularization parameter.minimizer- the minimizer to use to train this model.numIterations- the number of iterations to make.verbose- output the progress to STDOUT if true.
-
LogisticRegression
public LogisticRegression(de.jungblut.math.DoubleVector theta)
Creates a new logistic regression by already existing parameters.
-
-
Method Detail
-
train
public void train(de.jungblut.math.DoubleVector[] features, de.jungblut.math.DoubleVector[] outcome)Description copied from interface:ClassifierTrains this classifier with the given features and the outcome.- Specified by:
trainin interfaceClassifier- Overrides:
trainin classAbstractClassifieroutcome- the outcome must have classes labeled as doubles. E.G. in the binary case you have a single element and decide between 0d and 1d. In higher dimensional cases you have each of these single elements mapped to a dimension.
-
predict
public de.jungblut.math.DoubleVector predict(de.jungblut.math.DoubleVector features)
Description copied from interface:PredictorClassifies the given features.- Returns:
- the vector that contains an indicator at the index of the class. Usually zero or 1, in some cases it is a probability or activation value.
-
getTheta
public de.jungblut.math.DoubleVector getTheta()
- Returns:
- the learned weights.FSO
-
-