sklearn LogisticRegression without regularization

吃可爱长大的小学妹 提交于 2019-12-03 01:36:11
Yu Chen

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.

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.

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'.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!