Sklearn LogisticRegression Without Regularization
Solution 1:
Yes, choose as large a number as possible. In regularization, the cost function includes a regularization expression, and keep in mind that the C
parameter in sklearn regularization is the inverse of the regularization strength.
C
in this case is 1/lambda, subject to the condition that C
> 0.
Therefore, when C
approaches infinity, then lambda approaches 0. When this happens, then the cost function becomes your standard error function, since the regularization expression becomes, for all intents and purposes, 0.
Update: In sklearn versions 0.21 and higher, you can disable regularization by passing in penalty='none'
. Check out the documentation here.
Solution 2:
Go ahead and set C as large as you please. Also, make sure to use l2 since l1 with that implementation can be painfully slow.
Solution 3:
I got the same question and tried out the answer in addition to the other answers:
If set C to a large value does not work for you,
also set penalty='l1'
.
Post a Comment for "Sklearn LogisticRegression Without Regularization"