Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Adagrad optimiser for Linear regression by default #3291

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
public class LinearRegression implements Trainable, Predictable {
public static final String VERSION = "1.0.0";
private static final LinearRegressionParams.ObjectiveType DEFAULT_OBJECTIVE_TYPE = LinearRegressionParams.ObjectiveType.SQUARED_LOSS;
private static final LinearRegressionParams.OptimizerType DEFAULT_OPTIMIZER_TYPE = LinearRegressionParams.OptimizerType.SIMPLE_SGD;
private static final LinearRegressionParams.OptimizerType DEFAULT_OPTIMIZER_TYPE = LinearRegressionParams.OptimizerType.ADA_GRAD;
private static final double DEFAULT_LEARNING_RATE = 0.01;
// Momentum
private static final double DEFAULT_MOMENTUM_FACTOR = 0;
Expand Down Expand Up @@ -134,15 +134,15 @@ private void createOptimiser() {
break;
}
switch (optimizerType) {
case SIMPLE_SGD:
optimiser = SGD.getSimpleSGD(learningRate, momentumFactor, momentum);
break;
case LINEAR_DECAY_SGD:
optimiser = SGD.getLinearDecaySGD(learningRate, momentumFactor, momentum);
break;
case SQRT_DECAY_SGD:
optimiser = SGD.getSqrtDecaySGD(learningRate, momentumFactor, momentum);
break;
case ADA_GRAD:
optimiser = new AdaGrad(learningRate, epsilon);
break;
case ADA_DELTA:
optimiser = new AdaDelta(momentumFactor, epsilon);
break;
Expand All @@ -153,8 +153,9 @@ private void createOptimiser() {
optimiser = new RMSProp(learningRate, momentumFactor, epsilon, decayRate);
break;
default:
// Use default SGD with a constant learning rate.
optimiser = SGD.getSimpleSGD(learningRate, momentumFactor, momentum);
// Use AdaGrad by default, reference issue:
// https://github.com/opensearch-project/ml-commons/issues/3210#issuecomment-2556119802
optimiser = new AdaGrad(learningRate, epsilon);
rithin-pullela-aws marked this conversation as resolved.
Show resolved Hide resolved
break;
}
}
Expand Down
Loading