public class LogisticRegressionWithLBFGS extends GeneralizedLinearAlgorithm<LogisticRegressionModel> implements scala.Serializable
Earlier implementations of LogisticRegressionWithLBFGS applies a regularization penalty to all elements including the intercept. If this is called with one of standard updaters (L1Updater, or SquaredL2Updater) this is translated into a call to ml.LogisticRegression, otherwise this will use the existing mllib GeneralizedLinearAlgorithm trainer, resulting in a regularization penalty to the intercept.
Constructor and Description |
---|
LogisticRegressionWithLBFGS() |
Modifier and Type | Method and Description |
---|---|
LBFGS |
optimizer()
The optimizer to solve the problem.
|
LogisticRegressionModel |
run(RDD<LabeledPoint> input)
Run Logistic Regression with the configured parameters on an input RDD
of LabeledPoint entries.
|
LogisticRegressionModel |
run(RDD<LabeledPoint> input,
Vector initialWeights)
Run Logistic Regression with the configured parameters on an input RDD
of LabeledPoint entries starting from the initial weights provided.
|
LogisticRegressionWithLBFGS |
setNumClasses(int numClasses)
Set the number of possible outcomes for k classes classification problem in
Multinomial Logistic Regression.
|
getNumFeatures, isAddIntercept, setIntercept, setValidateData
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initializeLogging, initializeLogIfNecessary, initializeLogIfNecessary, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning
public LBFGS optimizer()
GeneralizedLinearAlgorithm
optimizer
in class GeneralizedLinearAlgorithm<LogisticRegressionModel>
public LogisticRegressionWithLBFGS setNumClasses(int numClasses)
numClasses
- (undocumented)public LogisticRegressionModel run(RDD<LabeledPoint> input)
If a known updater is used calls the ml implementation, to avoid applying a regularization penalty to the intercept, otherwise defaults to the mllib implementation. If more than two classes or feature scaling is disabled, always uses mllib implementation. If using ml implementation, uses ml code to generate initial weights.
run
in class GeneralizedLinearAlgorithm<LogisticRegressionModel>
input
- (undocumented)public LogisticRegressionModel run(RDD<LabeledPoint> input, Vector initialWeights)
If a known updater is used calls the ml implementation, to avoid applying a regularization penalty to the intercept, otherwise defaults to the mllib implementation. If more than two classes or feature scaling is disabled, always uses mllib implementation. Uses user provided weights.
In the ml LogisticRegression implementation, the number of corrections
used in the LBFGS update can not be configured. So optimizer.setNumCorrections()
will have no effect if we fall into that route.
run
in class GeneralizedLinearAlgorithm<LogisticRegressionModel>
input
- (undocumented)initialWeights
- (undocumented)