0

In sklearn in python there is a C parameter (regularization parameter) for the LogisticRegression.

Now, I'm wondering what is the equivalent in R language? When I do logistic regression in R, I do it like this:

glm(<outcome> ~ <covariates>, family="binomial")

But what is it using for the C parameter? The C is for regularization, but I can't find any such equivalent in R?

Here are some places I checked:

http://data.princeton.edu/R/glms.html

desertnaut
  • 57,590
  • 26
  • 140
  • 166
makansij
  • 9,303
  • 37
  • 105
  • 183
  • 2
    You need to read up on "penalization". The glm function doesn't provide that. Need other packages. Educate yourself. – IRTFM Mar 18 '16 at 06:53
  • Thank you, that would be a good thing to read up on. Can you suggest some resources that have a nice blend of theory and practice? – makansij Mar 19 '16 at 05:06

1 Answers1

1

In R, the regularization is not implemented in GLM. You can use Liblinear package in R to do regularized regression. The link https://cran.r-project.org/web/packages/LiblineaR/LiblineaR.pdf is the manual for Liblinear package. Its a 10 page document only. You can go through it pretty quickly.

I think it is the closet to the logistic regression in python.

As far as your question is concerned, you can look into the cost parameter. In the document, it is said that this parameter is the regularization parameter i.e. C parameter.

Kumar Manglam
  • 2,780
  • 1
  • 19
  • 28
  • Hmmmm. Interesting. To help my understanding, I think that if the `C` parameter is 1.0, then the there is no penalty in the LogisticRegression in `sklearn` in `python`. Is that true? – makansij Mar 19 '16 at 04:17
  • Downvote explanation. This is asking a much too broad question. There are several R packages that do some form of "regularization" to the cost parameter. Bad questions should not be answered if there is no good coding answer possible. It is too vague and should have been posted on CV.com. – IRTFM Mar 19 '16 at 06:26