Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: scripts/slave/recipe_modules/auto_bisect/resources/significantly_different_inner.py

Issue 2247373002: Refactor stages 1, 2 and test_api overhaul. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Addressing all early feedback. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 """This file is meant to be run in an environment where scipy is available."""
2 import json
3 import logging
4 import sys
5
6 try:
7 from scipy import stats
8 except ImportError:
9 def main():
10 # scipy required, see module docstring.
11 logging.warning(sys.modules[__name__].__doc__)
12 return 1
13 else:
14
15 def main():
16 if len(sys.argv) < 4:
17 return 1
18 _, list_a, list_b, significance = sys.argv[:4]
19 list_a = json.loads(list_a)
20 list_b = json.loads(list_b)
21 significance = float(significance)
22
23 mann_whitney_p_value = stats.mannwhitneyu(list_a, list_b).pvalue
24
25 results = {
26 'first_sample': list_a,
27 'second_sample': list_b,
28 'mann_p_value': mann_whitney_p_value,
29 }
30
31 results['significantly_different'] = bool(
32 float(results['mann_p_value']) < float(significance))
33
34 print json.dumps(results)
35 return 0
36
37 if __name__ == '__main__':
38 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698