|
16 | 16 | }, |
17 | 17 | { |
18 | 18 | "cell_type": "code", |
19 | | - "execution_count": 6, |
| 19 | + "execution_count": 3, |
20 | 20 | "metadata": {}, |
21 | 21 | "outputs": [], |
22 | 22 | "source": [ |
|
25 | 25 | "\n", |
26 | 26 | "from ya_glm.toy_data import sample_sparse_lin_reg\n", |
27 | 27 | "from ya_glm.backends.fista.LinearRegression import FcpLLA, FcpLLACV,\\\n", |
28 | | - " LassoCV, RidgeCV, LassoENetCV" |
| 28 | + " LassoCV, RidgeCV, ENetCV" |
29 | 29 | ] |
30 | 30 | }, |
31 | 31 | { |
|
37 | 37 | }, |
38 | 38 | { |
39 | 39 | "cell_type": "code", |
40 | | - "execution_count": 2, |
| 40 | + "execution_count": 4, |
41 | 41 | "metadata": {}, |
42 | 42 | "outputs": [], |
43 | 43 | "source": [ |
|
49 | 49 | }, |
50 | 50 | { |
51 | 51 | "cell_type": "code", |
52 | | - "execution_count": 3, |
| 52 | + "execution_count": 5, |
53 | 53 | "metadata": {}, |
54 | 54 | "outputs": [], |
55 | 55 | "source": [ |
|
84 | 84 | }, |
85 | 85 | { |
86 | 86 | "cell_type": "code", |
87 | | - "execution_count": 4, |
| 87 | + "execution_count": 6, |
88 | 88 | "metadata": {}, |
89 | 89 | "outputs": [], |
90 | 90 | "source": [ |
|
96 | 96 | }, |
97 | 97 | { |
98 | 98 | "cell_type": "code", |
99 | | - "execution_count": 5, |
| 99 | + "execution_count": null, |
100 | 100 | "metadata": {}, |
101 | 101 | "outputs": [ |
102 | 102 | { |
103 | 103 | "name": "stdout", |
104 | 104 | "output_type": "stream", |
105 | 105 | "text": [ |
106 | | - "CPU times: user 152 ms, sys: 81.5 ms, total: 233 ms\n", |
107 | | - "Wall time: 3.7 s\n", |
| 106 | + "CPU times: user 142 ms, sys: 75.6 ms, total: 218 ms\n", |
| 107 | + "Wall time: 3.16 s\n", |
108 | 108 | "Lasso L2 to truth 0.5399115512254988 \n", |
109 | 109 | "\n", |
110 | | - "CPU times: user 246 ms, sys: 84 ms, total: 330 ms\n", |
111 | | - "Wall time: 1.08 s\n", |
| 110 | + "CPU times: user 257 ms, sys: 117 ms, total: 374 ms\n", |
| 111 | + "Wall time: 836 ms\n", |
112 | 112 | "Ridge L2 to truth 1.4667162260738444 \n", |
113 | 113 | "\n", |
114 | | - "CPU times: user 1.02 s, sys: 77.9 ms, total: 1.1 s\n", |
115 | | - "Wall time: 18.1 s\n", |
| 114 | + "CPU times: user 823 ms, sys: 66.4 ms, total: 889 ms\n", |
| 115 | + "Wall time: 13.9 s\n", |
116 | 116 | "ENet L2 to truth 0.5399115512254988 \n", |
117 | | - "\n", |
118 | | - "CPU times: user 1.92 s, sys: 221 ms, total: 2.14 s\n", |
119 | | - "Wall time: 6.35 s\n", |
120 | | - "FCP, lasso init, one step L2 to truth 0.2934270519442212 \n", |
121 | | - "\n", |
122 | | - "CPU times: user 2.01 s, sys: 205 ms, total: 2.21 s\n", |
123 | | - "Wall time: 11.1 s\n", |
124 | | - "FCP, ridge init, one step L2 to truth 0.3433528089934003 \n", |
125 | | - "\n", |
126 | | - "CPU times: user 2.65 s, sys: 196 ms, total: 2.85 s\n", |
127 | | - "Wall time: 21.1 s\n", |
128 | | - "FCP, enet init, one step L2 to truth 0.2934270519442212 \n", |
129 | | - "\n", |
130 | | - "CPU times: user 2.59 s, sys: 218 ms, total: 2.81 s\n", |
131 | | - "Wall time: 18.4 s\n", |
132 | | - "FCP, lasso init, many steps L2 to truth 0.2964122567536647 \n", |
133 | | - "\n", |
134 | | - "CPU times: user 2.56 s, sys: 265 ms, total: 2.83 s\n", |
135 | | - "Wall time: 19.7 s\n", |
136 | | - "FCP, ridge init, many steps L2 to truth 0.2964122567536647 \n", |
137 | | - "\n", |
138 | | - "CPU times: user 2.85 s, sys: 201 ms, total: 3.05 s\n", |
139 | | - "Wall time: 28.5 s\n", |
140 | | - "FCP, enet init, many steps L2 to truth 0.2964122567536647 \n", |
141 | 117 | "\n" |
142 | 118 | ] |
143 | 119 | } |
|
157 | 133 | " np.linalg.norm(ridge.best_estimator_.coef_ - coef), '\\n')\n", |
158 | 134 | "\n", |
159 | 135 | "# ElasticNet\n", |
160 | | - "%time enet = LassoENetCV(l1_ratio='tune', **cv_kws).fit(X, y)\n", |
| 136 | + "%time enet = ENetCV(l1_ratio='tune', **cv_kws).fit(X, y)\n", |
161 | 137 | "print('ENet L2 to truth',\n", |
162 | 138 | " np.linalg.norm(enet.best_estimator_.coef_ - coef), '\\n')\n", |
163 | 139 | "\n", |
|
0 commit comments