|
1 | 1 | from statistics import (mean, fmean, geometric_mean, harmonic_mean, variance,
|
2 |
| - stdev, pvariance, pstdev, correlation, covariance, |
3 |
| - linear_regression, mode) |
| 2 | + stdev, pvariance, pstdev, |
| 3 | + mode) |
4 | 4 | from lpython import i32, f64, i64, f32
|
5 | 5 |
|
6 | 6 |
|
@@ -127,67 +127,67 @@ def test_pstdev():
|
127 | 127 | assert abs(k - 0.37537181567080935) < eps
|
128 | 128 |
|
129 | 129 |
|
130 |
| -def test_covariance(): |
131 |
| - a: list[i32] |
132 |
| - a = [1, 2, 3, 4, 5, 6, 7, 8, 9] |
133 |
| - b: list[i32] |
134 |
| - b = [1, 2, 3, 1, 2, 3, 1, 2, 3] |
135 |
| - j: f64 |
136 |
| - j = covariance(a, b) |
137 |
| - assert abs(j - 0.75) < eps |
| 130 | +# def test_covariance(): |
| 131 | +# a: list[i32] |
| 132 | +# a = [1, 2, 3, 4, 5, 6, 7, 8, 9] |
| 133 | +# b: list[i32] |
| 134 | +# b = [1, 2, 3, 1, 2, 3, 1, 2, 3] |
| 135 | +# j: f64 |
| 136 | +# j = covariance(a, b) |
| 137 | +# assert abs(j - 0.75) < eps |
138 | 138 |
|
139 |
| - c: list[f64] |
140 |
| - c = [2.74, 1.23, 2.63, 2.22, 3.0, 1.98] |
141 |
| - d: list[f64] |
142 |
| - d = [9.4, 1.23, 2.63, 22.4, 1.9, 13.98] |
143 |
| - k: f64 |
144 |
| - k = covariance(c, d) |
145 |
| - assert abs(k + 0.24955999999999934) < eps |
| 139 | +# c: list[f64] |
| 140 | +# c = [2.74, 1.23, 2.63, 2.22, 3.0, 1.98] |
| 141 | +# d: list[f64] |
| 142 | +# d = [9.4, 1.23, 2.63, 22.4, 1.9, 13.98] |
| 143 | +# k: f64 |
| 144 | +# k = covariance(c, d) |
| 145 | +# assert abs(k + 0.24955999999999934) < eps |
146 | 146 |
|
147 | 147 |
|
148 |
| -def test_correlation(): |
149 |
| - a: list[i32] |
150 |
| - a = [11, 2, 7, 4, 15, 6, 10, 8, 9, 1, 11, 5, 13, 6, 15] |
151 |
| - b: list[i32] |
152 |
| - b = [2, 5, 17, 6, 10, 8, 13, 4, 6, 9, 11, 2, 5, 4, 7] |
| 148 | +# def test_correlation(): |
| 149 | +# a: list[i32] |
| 150 | +# a = [11, 2, 7, 4, 15, 6, 10, 8, 9, 1, 11, 5, 13, 6, 15] |
| 151 | +# b: list[i32] |
| 152 | +# b = [2, 5, 17, 6, 10, 8, 13, 4, 6, 9, 11, 2, 5, 4, 7] |
153 | 153 |
|
154 |
| - j: f64 |
155 |
| - j = correlation(a, b) |
156 |
| - assert abs(j - 0.11521487988958108) < eps |
| 154 | +# j: f64 |
| 155 | +# j = correlation(a, b) |
| 156 | +# assert abs(j - 0.11521487988958108) < eps |
157 | 157 |
|
158 |
| - c: list[f64] |
159 |
| - c = [2.0, 23.0, 24.55, 64.436, 5403.23] |
160 |
| - d: list[f64] |
161 |
| - d = [26.9, 75.6, 34.06, 356.89, 759.26] |
| 158 | +# c: list[f64] |
| 159 | +# c = [2.0, 23.0, 24.55, 64.436, 5403.23] |
| 160 | +# d: list[f64] |
| 161 | +# d = [26.9, 75.6, 34.06, 356.89, 759.26] |
162 | 162 |
|
163 |
| - j = correlation(c, c) |
164 |
| - assert abs(j - 1.0) < eps |
| 163 | +# j = correlation(c, c) |
| 164 | +# assert abs(j - 1.0) < eps |
165 | 165 |
|
166 |
| - j = correlation(c, d) |
167 |
| - assert abs(j - 0.9057925526720572) < eps |
| 166 | +# j = correlation(c, d) |
| 167 | +# assert abs(j - 0.9057925526720572) < eps |
168 | 168 |
|
169 |
| -def test_linear_regression(): |
170 |
| - c: list[f64] |
171 |
| - c = [2.74, 1.23, 2.63, 2.22, 3.0, 1.98] |
172 |
| - d: list[f64] |
173 |
| - d = [9.4, 1.23, 2.63, 22.4, 1.9, 13.98] |
| 169 | +# def test_linear_regression(): |
| 170 | +# c: list[f64] |
| 171 | +# c = [2.74, 1.23, 2.63, 2.22, 3.0, 1.98] |
| 172 | +# d: list[f64] |
| 173 | +# d = [9.4, 1.23, 2.63, 22.4, 1.9, 13.98] |
174 | 174 |
|
175 |
| - slope: f64 |
176 |
| - intercept: f64 |
177 |
| - slope, intercept = linear_regression(c, d) |
| 175 | +# slope: f64 |
| 176 | +# intercept: f64 |
| 177 | +# slope, intercept = linear_regression(c, d) |
178 | 178 |
|
179 |
| - assert abs(slope + 0.6098133124816717) < eps |
180 |
| - assert abs(intercept - 9.992570618707845) < eps |
| 179 | +# assert abs(slope + 0.6098133124816717) < eps |
| 180 | +# assert abs(intercept - 9.992570618707845) < eps |
181 | 181 |
|
182 |
| - a: list[i32] |
183 |
| - b: list[i32] |
184 |
| - a = [12, 24, 2, 1, 43, 53, 23] |
185 |
| - b = [2, 13, 14, 63, 49, 7, 3] |
| 182 | +# a: list[i32] |
| 183 | +# b: list[i32] |
| 184 | +# a = [12, 24, 2, 1, 43, 53, 23] |
| 185 | +# b = [2, 13, 14, 63, 49, 7, 3] |
186 | 186 |
|
187 |
| - slope, intercept = linear_regression(a, b) |
| 187 | +# slope, intercept = linear_regression(a, b) |
188 | 188 |
|
189 |
| - assert abs(slope + 0.18514007308160782) < eps |
190 |
| - assert abs(intercept - 25.750304506699152) < eps |
| 189 | +# assert abs(slope + 0.18514007308160782) < eps |
| 190 | +# assert abs(intercept - 25.750304506699152) < eps |
191 | 191 |
|
192 | 192 | def test_mode():
|
193 | 193 | a: list[i32]
|
@@ -228,9 +228,9 @@ def check():
|
228 | 228 | test_stdev()
|
229 | 229 | test_pvariance()
|
230 | 230 | test_pstdev()
|
231 |
| - test_linear_regression() |
232 |
| - test_correlation() |
233 |
| - test_covariance() |
| 231 | + # test_linear_regression() |
| 232 | + # test_correlation() |
| 233 | + # test_covariance() |
234 | 234 | test_mode()
|
235 | 235 |
|
236 | 236 | check()
|
0 commit comments