Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

What can be the reason for different results compared to R glmnet? #75

Open
slavakx opened this issue Jan 5, 2022 · 0 comments
Open

Comments

@slavakx
Copy link

slavakx commented Jan 5, 2022

Hi,

I have the following pipeline.
First I apply ridge regression using 10-cv to find the best lambda.
I get same lambda max and lambda best as in R cv.glmnet.

Next, I refit the model using the best lambda from the first step, without intercept and compare it to the results of R glmnet.
The coefficients and predictions are different. Why is that?

Comparison of coefficients:
R
(Intercept) 0
f1 -0.004059542
f2 0.377331808
f3 1.006589044
f4 0.876858914
f5 0.140710854
f6 730268.470575249
f7 244447.850561236
f8 537663.923355049
f9 176279.892636801
f10 662.748853227
f11 739399.127039033

python:
Intercept 0
f1 -0.16957
f2 0.33352
f3 0.80749
f4 0.71330
f5 0.11385
f6 801091.27661
f7 293769.02256
f8 557147.70998
f9 251954.31707
f10 797640.12411
f11 1086129.27954

Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant