-
Notifications
You must be signed in to change notification settings - Fork 24
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 set max_alpha
in GeneralizedLinearRegressorCV
?
#810
Comments
The documentation should be clearer. |
Thanks! For |
For future reference:
The latter.
then In [1]: import numpy as np
imp
In [2]: import glum
In [3]: rng = np.random.default_rng(0)
In [4]: X = rng.random((100, 3))
In [5]: y = rng.normal(size=100)
In [6]: glm = glum.GeneralizedLinearRegressor(l1_ratio=0.5, min_alpha=0.001, alpha_search=True)
In [7]: glm.fit(X, y)
Out[7]: GeneralizedLinearRegressor(alpha_search=True, l1_ratio=0.5, min_alpha=0.001)
In [8]: glm.coef_path_[0]
Out[8]: array([0., 0., 0.])
In [9]: glm.coef_path_[1]
Out[9]: array([ 0. , -0.00952177, 0. ])
In [10]: glm._alphas
Out[10]:
array([0.04719881, 0.04539653, 0.04366307, 0.0419958 , 0.04039219,
0.03884982, 0.03736635, 0.03593952, 0.03456717, 0.03324723,
0.03197769, 0.03075663, 0.02958219, 0.0284526 , 0.02736614,
0.02632117, 0.0253161 , 0.0243494 , 0.02341962, 0.02252535,
0.02166522, 0.02083794, 0.02004224, 0.01927693, 0.01854085,
0.01783287, 0.01715192, 0.01649698, 0.01586704, 0.01526116,
0.01467842, 0.01411792, 0.01357883, 0.01306033, 0.01256162,
0.01208196, 0.01162061, 0.01117688, 0.01075009, 0.0103396 ,
0.00994478, 0.00956504, 0.0091998 , 0.00884851, 0.00851063,
0.00818565, 0.00787308, 0.00757245, 0.0072833 , 0.00700519,
0.00673769, 0.00648042, 0.00623296, 0.00599496, 0.00576604,
0.00554587, 0.0053341 , 0.00513042, 0.00493451, 0.00474609,
0.00456486, 0.00439055, 0.0042229 , 0.00406165, 0.00390655,
0.00375738, 0.00361391, 0.00347591, 0.00334318, 0.00321552,
0.00309274, 0.00297464, 0.00286106, 0.00275181, 0.00264673,
0.00254567, 0.00244846, 0.00235497, 0.00226504, 0.00217855,
0.00209536, 0.00201535, 0.0019384 , 0.00186438, 0.00179319,
0.00172472, 0.00165886, 0.00159551, 0.00153459, 0.00147599,
0.00141963, 0.00136542, 0.00131328, 0.00126314, 0.0012149 ,
0.00116851, 0.00112389, 0.00108098, 0.0010397 , 0.001 ])
In [17]: glm = glum.GeneralizedLinearRegressor(l1_ratio=0, alpha_search=True, min_alpha=0.001)
In [18]: glm.fit(X, y)
Out[18]: GeneralizedLinearRegressor(alpha_search=True, min_alpha=0.001)
In [19]: glm.coef_path_[0]
Out[19]: array([ 0.00184075, -0.00233987, 0.00137422])
In [20]: glm._alphas
Out[20]:
array([1.00000000e+01, 9.11162756e+00, 8.30217568e+00, 7.56463328e+00,
6.89261210e+00, 6.28029144e+00, 5.72236766e+00, 5.21400829e+00,
4.75081016e+00, 4.32876128e+00, 3.94420606e+00, 3.59381366e+00,
3.27454916e+00, 2.98364724e+00, 2.71858824e+00, 2.47707636e+00,
2.25701972e+00, 2.05651231e+00, 1.87381742e+00, 1.70735265e+00,
1.55567614e+00, 1.41747416e+00, 1.29154967e+00, 1.17681195e+00,
1.07226722e+00, 9.77009957e-01, 8.90215085e-01, 8.11130831e-01,
7.39072203e-01, 6.73415066e-01, 6.13590727e-01, 5.59081018e-01,
5.09413801e-01, 4.64158883e-01, 4.22924287e-01, 3.85352859e-01,
3.51119173e-01, 3.19926714e-01, 2.91505306e-01, 2.65608778e-01,
2.42012826e-01, 2.20513074e-01, 2.00923300e-01, 1.83073828e-01,
1.66810054e-01, 1.51991108e-01, 1.38488637e-01, 1.26185688e-01,
1.14975700e-01, 1.04761575e-01, 9.54548457e-02, 8.69749003e-02,
7.92482898e-02, 7.22080902e-02, 6.57933225e-02, 5.99484250e-02,
5.46227722e-02, 4.97702356e-02, 4.53487851e-02, 4.13201240e-02,
3.76493581e-02, 3.43046929e-02, 3.12571585e-02, 2.84803587e-02,
2.59502421e-02, 2.36448941e-02, 2.15443469e-02, 1.96304065e-02,
1.78864953e-02, 1.62975083e-02, 1.48496826e-02, 1.35304777e-02,
1.23284674e-02, 1.12332403e-02, 1.02353102e-02, 9.32603347e-03,
8.49753436e-03, 7.74263683e-03, 7.05480231e-03, 6.42807312e-03,
5.85702082e-03, 5.33669923e-03, 4.86260158e-03, 4.43062146e-03,
4.03701726e-03, 3.67837977e-03, 3.35160265e-03, 3.05385551e-03,
2.78255940e-03, 2.53536449e-03, 2.31012970e-03, 2.10490414e-03,
1.91791026e-03, 1.74752840e-03, 1.59228279e-03, 1.45082878e-03,
1.32194115e-03, 1.20450354e-03, 1.09749877e-03, 1.00000000e-03])
In [21]: glm = glum.GeneralizedLinearRegressor(l1_ratio=0.001, alpha_search=True, min_alpha=0.001)
In [22]: glm.fit(X, y)
Out[22]: GeneralizedLinearRegressor(alpha_search=True, l1_ratio=0.001, min_alpha=0.001)
In [23]: glm.coef_path_[0]
Out[23]: array([0., 0., 0.])
In [24]: glm._alphas
Out[24]:
array([2.35994038e+01, 2.13172076e+01, 1.92557127e+01, 1.73935760e+01,
1.57115185e+01, 1.41921255e+01, 1.28196665e+01, 1.15799320e+01,
1.04600869e+01, 9.44853714e+00, 8.53480999e+00, 7.70944544e+00,
6.96389833e+00, 6.29044985e+00, 5.68212766e+00, 5.13263368e+00,
4.63627888e+00, 4.18792441e+00, 3.78292836e+00, 3.41709773e+00,
3.08664499e+00, 2.78814891e+00, 2.51851909e+00, 2.27496400e+00,
2.05496208e+00, 1.85623559e+00, 1.67672707e+00, 1.51457805e+00,
1.36810976e+00, 1.23580579e+00, 1.11629636e+00, 1.00834416e+00,
9.10831563e-01, 8.22748984e-01, 7.43184489e-01, 6.71314333e-01,
6.06394428e-01, 5.47752646e-01, 4.94781858e-01, 4.46933645e-01,
4.03712626e-01, 3.64671325e-01, 3.29405539e-01, 2.97550154e-01,
2.68775366e-01, 2.42783263e-01, 2.19304744e-01, 1.98096731e-01,
1.78939654e-01, 1.61635174e-01, 1.46004135e-01, 1.31884707e-01,
1.19130708e-01, 1.07610092e-01, 9.72035860e-02, 8.78034478e-02,
7.93123562e-02, 7.16424014e-02, 6.47141747e-02, 5.84559469e-02,
5.28029252e-02, 4.76965827e-02, 4.30840526e-02, 3.89175803e-02,
3.51540295e-02, 3.17544354e-02, 2.86836013e-02, 2.59097343e-02,
2.34041160e-02, 2.11408052e-02, 1.90963694e-02, 1.72496421e-02,
1.55815039e-02, 1.40746841e-02, 1.27135823e-02, 1.14841067e-02,
1.03735284e-02, 9.37034939e-03, 8.46418345e-03, 7.64564889e-03,
6.90627126e-03, 6.23839565e-03, 5.63510740e-03, 5.09016054e-03,
4.59791314e-03, 4.15326885e-03, 3.75162419e-03, 3.38882085e-03,
3.06110264e-03, 2.76507665e-03, 2.49767805e-03, 2.25613841e-03,
2.03795703e-03, 1.84087502e-03, 1.66285196e-03, 1.50204474e-03,
1.35678850e-03, 1.22557935e-03, 1.10705887e-03, 1.00000000e-03]) |
The class does not have an argument
max_alpha
. Themin_alpha
description statesIf I set
min_alpha
andmin_alpha_ratio
I get a warningThe text was updated successfully, but these errors were encountered: