|
21 | 21 | of both invocations is the same, the test passes (with us being alerted to this situtation via a special pipeline that |
22 | 22 | does not block PRs). If not, it fails, preventing PRs from introducing new vulnerable dependencies. |
23 | 23 | """ |
24 | | -import statistics |
25 | 24 | from pathlib import Path |
26 | 25 | from tempfile import TemporaryDirectory |
27 | | -from typing import Callable, List, Optional, TypeVar |
28 | | - |
29 | | -import scipy |
| 26 | +from typing import Callable, Optional, TypeVar |
30 | 27 |
|
31 | 28 | from framework import utils |
32 | 29 | from framework.defs import FC_WORKSPACE_DIR |
@@ -170,32 +167,6 @@ def set_did_not_grow_comparator( |
170 | 167 | ) |
171 | 168 |
|
172 | 169 |
|
173 | | -def check_regression( |
174 | | - a_samples: List[float], b_samples: List[float], *, n_resamples: int = 9999 |
175 | | -): |
176 | | - """Checks for a regression by performing a permutation test. A permutation test is a non-parametric test that takes |
177 | | - three parameters: Two populations (sets of samples) and a function computing a "statistic" based on two populations. |
178 | | - First, the test computes the statistic for the initial populations. It then randomly |
179 | | - permutes the two populations (e.g. merges them and then randomly splits them again). For each such permuted |
180 | | - population, the statistic is computed. Then, all the statistics are sorted, and the percentile of the statistic for the |
181 | | - initial populations is computed. We then look at the fraction of statistics that are larger/smaller than that of the |
182 | | - initial populations. The minimum of these two fractions will then become the p-value. |
183 | | -
|
184 | | - The idea is that if the two populations are indeed drawn from the same distribution (e.g. if performance did not |
185 | | - change), then permuting will not affect the statistic (indeed, it should be approximately normal-distributed, and |
186 | | - the statistic for the initial populations will be somewhere "in the middle"). |
187 | | -
|
188 | | - Useful for performance tests. |
189 | | - """ |
190 | | - return scipy.stats.permutation_test( |
191 | | - (a_samples, b_samples), |
192 | | - # Compute the difference of means, such that a positive different indicates potential for regression. |
193 | | - lambda x, y: statistics.mean(y) - statistics.mean(x), |
194 | | - vectorized=False, |
195 | | - n_resamples=n_resamples, |
196 | | - ) |
197 | | - |
198 | | - |
199 | 170 | @with_filelock |
200 | 171 | def git_clone(clone_path, commitish): |
201 | 172 | """Clone the repository at `commit`. |
|
0 commit comments