Skip to content
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

How to decide what range of alphas to try in ridge regression #5

Open
muspain opened this issue Feb 5, 2023 · 1 comment
Open

How to decide what range of alphas to try in ridge regression #5

muspain opened this issue Feb 5, 2023 · 1 comment

Comments

@muspain
Copy link

muspain commented Feb 5, 2023

How to decide what range of alphas to try in ridge regression
lasso_cv = LassoCV(normalize=True, alphas=np.logspace(-10, 1, 400))

@emma-oc
Copy link
Contributor

emma-oc commented Feb 5, 2023

Good question - I think there is no correct answer to this, but more a subjective choice based on how much regularization/shrinkage you'd like to put on the parameters. According to scikit-learn documentation, if you do not specify the range of alphas, it will automatically select the best alpha from the regularization path, which is defined by eps and n_alphas via CV, which sounds like a good default to me.

From a general learning perspective, I found this post link where there is some discussion on this topic. I also found this chapter link pretty helpful in terms of visualizing the regularization on parameters, though the code is in R...

From a practical perspective, you can usually define a logspace range, then do a model selection using goodness-of-fit metric (e.g. AIC, BIC, R^2, etc.), or use a more data-driven CV to choose the optimal parameter value.

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

No branches or pull requests

2 participants