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

Specifying the lambda path #24

Open
cruyffturn opened this issue Mar 24, 2022 · 1 comment
Open

Specifying the lambda path #24

cruyffturn opened this issue Mar 24, 2022 · 1 comment

Comments

@cruyffturn
Copy link

Thank you for making this library! Is it possible to specify the lambda path for the model to search?

@idc9
Copy link
Collaborator

idc9 commented Mar 25, 2022

Yup, see https://github.com/yaglm/yaglm/blob/main/docs/2_tuning.ipynb You can do this at 3 levels

from yaglm.config.penalty import Lasso
from yaglm.GlmTuned import GlmCV

# default penalty sequence created automatically from X/Y
penalty = Lasso()

# specify details of how the automatically inferred sequence is created
penalty=Lasso().tune(n_pen_vals=100,
                     pen_min_mult=1e-3,
                     pen_max_mult=1,
                     pen_spacing='log')

# manually specify the tuning parameter sequence
penalty=Lasso().tune(pen_val_seq=[.1, 1, 10, 100])

est = GlmCV(penalty=penalty).fit(X, y)

See the documentation of Lasso().tune()

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