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

Unified Diff: bin/compare

Issue 1416833004: Make bin/c and bin/compare work on Windows. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bin/c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/compare
diff --git a/bin/compare b/bin/compare
index 82f85d5fd91ab724e5c3aa6e2f1e65508fa10f79..95d4100e950a22182ed3e58e15913f3e1611e4c1 100755
--- a/bin/compare
+++ b/bin/compare
@@ -1,10 +1,13 @@
#!/usr/bin/env python
import argparse
-import numpy
import sys
-from scipy.stats import mannwhitneyu
-from scipy.stats import sem
+
+have_scipy = True
+try:
+ import scipy.stats
+except:
+ have_scipy = False
SIGNIFICANCE_THRESHOLD = 0.0001
@@ -32,15 +35,17 @@ for (path, d) in [(args.baseline, a), (args.experiment, b)]:
common = set(a.keys()).intersection(b.keys())
+def mean(xs):
+ return sum(xs) / len(xs)
+
ps = []
for key in common:
- _, p = mannwhitneyu(a[key], b[key]) # Non-parametric t-test. Doesn't assume normal dist.
- if args.use_means:
- am, bm = numpy.mean(a[key]), numpy.mean(b[key])
- asem, bsem = sem(a[key]), sem(b[key])
- else:
- am, bm = min(a[key]), min(b[key])
- asem, bsem = 0, 0
+ p, asem, bsem = 0, 0, 0
+ m = mean if args.use_means else min
+ am, bm = m(a[key]), m(b[key])
+ if have_scipy:
+ _, p = scipy.stats.mannwhitneyu(a[key], b[key])
+ asem, bsem = scipy.stats.sem(a[key]), sem(b[key])
ps.append((bm/am, p, key, am, bm, asem, bsem))
ps.sort(reverse=True)
« no previous file with comments | « bin/c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698