-
Notifications
You must be signed in to change notification settings - Fork 5
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
Convert parameters of logistic regression model from glment to sklearn #6
Comments
Thanks @lingling93 for the interest. Looking at the source code for the fit$cv_model <- glmnet::cv.glmnet(x = X, y = y, weights = w, family='binomial',
alpha=alpha, parallel=TRUE, ...)
fit$lambda <- fit$cv_model[[s]] I believe the closest thing in sklearn is If I remember correctly, Additional References |
@dhimmel Thank you for your quick and informative answer. |
The
For Project Rephetio, we use
The “one-standard-error” rule is further described in Regularization Paths for Generalized Linear Models via Coordinate Descent:
In Project Rephetio discussion, I made the following comment related to our use of
|
@dhimmel Hi Daniel, problem solved. I tried python glmnet to reproduce your work, training the logistic regression model and matching every parameter. Then I checked the lambda_best, with different seeds, it fluctuate a little bit, with a certain seed, it gives a close result to yours. The coefficient of prior_prob is more steady around 0.7. So I think this is enough to prove that I can use python glmnet. |
Cool! I'm looking forward to trying out the python glmnet myself. Yeah there is a random seed and I'm guessing it won't be possible to achieve exactly the same results in python versus R because the randomness will be different. |
code in
predictr.ipynb
:How to match these parameters with sklearn logistic regression parameters?
The text was updated successfully, but these errors were encountered: