4
$\begingroup$

In sklearn, for logistic regression, you can define the penalty, the regularization rate and other variables. Is there a way to set the learning rate?

$\endgroup$
4
$\begingroup$

sklearn.linear_model.LogisticRegression doesn't use SGD, so there's no learning rate.

I think sklearn.linear_model.SGDClassifier is what you need, which is a linear classifier with SGD training.

References

http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html

http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.SGDClassifier.html

$\endgroup$
1
  • $\begingroup$ Thank you for the links and answers. So, how is LogisticRegression implemented in sklearn? I am not sure I fully understand what is the coordinate descent they use for it. $\endgroup$ – user Feb 5 '17 at 19:09
3
$\begingroup$

According to sklearn's Logistic source code, the solver used to minimize the loss function is the SAG solver (Stochastic Average Gradient). This paper defines this method, and in this link there is the implementation of the sag solver. This implementation of the solver uses a method to obtain the step size (learning rate), so there is not a way that you can change the learning rate (unless you want to change the source code).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.