[LNT] r208734 - Use Python implementation of MWU test

Yi Kong Yi.Kong at arm.com
Tue May 13 15:06:17 PDT 2014


Author: kongyi
Date: Tue May 13 17:06:16 2014
New Revision: 208734

URL: http://llvm.org/viewvc/llvm-project?rev=208734&view=rev
Log:
Use Python implementation of MWU test

Turns out we have a Mann-Whitney U test implementation(for large sample
size) in external.stats.stats directory all along. No longer depends on
SciPy.

Modified:
    lnt/trunk/lnt/server/reporting/analysis.py
    lnt/trunk/lnt/server/ui/views.py
    lnt/trunk/lnt/util/stats.py

Modified: lnt/trunk/lnt/server/reporting/analysis.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/reporting/analysis.py?rev=208734&r1=208733&r2=208734&view=diff
==============================================================================
--- lnt/trunk/lnt/server/reporting/analysis.py (original)
+++ lnt/trunk/lnt/server/reporting/analysis.py Tue May 13 17:06:16 2014
@@ -58,9 +58,6 @@ class ComparisonResult:
 
     def get_value_status(self, confidence_interval=2.576,
                          value_precision=0.0001, ignore_small=True):
-        """
-        Raises ImportError if SciPy is not installed and sample size is too large.
-        """
         if self.current is None or self.previous is None:
             return None
 

Modified: lnt/trunk/lnt/server/ui/views.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/views.py?rev=208734&r1=208733&r2=208734&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/views.py (original)
+++ lnt/trunk/lnt/server/ui/views.py Tue May 13 17:06:16 2014
@@ -301,11 +301,7 @@ Unable to find a v0.4 run for this ID. P
 
 @v4_route("/<int:id>")
 def v4_run(id):
-    try:
-        info = V4RequestInfo(id)
-    except ImportError:
-        return render_template("error.html",
-            message="SciPy is not installed on server and sample size is too large.")
+    info = V4RequestInfo(id)
 
     ts = info.ts
     run = info.run

Modified: lnt/trunk/lnt/util/stats.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/util/stats.py?rev=208734&r1=208733&r2=208734&view=diff
==============================================================================
--- lnt/trunk/lnt/util/stats.py (original)
+++ lnt/trunk/lnt/util/stats.py Tue May 13 17:06:16 2014
@@ -1,4 +1,5 @@
 import math
+from lnt.external.stats.stats import mannwhitneyu as mannwhitneyu_large
 
 def mean(l):
     return sum(l)/len(l)
@@ -22,15 +23,12 @@ def standard_deviation(l):
 
 def mannwhitneyu(a, b, sigLevel = .05):
     """
-    Determine if sample a and b are the same at given significance level,
-    raises ImportError if SciPy is not installed on server and sample size is
-    too large.
+    Determine if sample a and b are the same at given significance level.
     """
     if len(a) <= 20 and len(b) <= 20:
         return mannwhitneyu_small(a, b, sigLevel)
     else:
         try:
-            from scipy.stats import mannwhitneyu as mannwhitneyu_large
             # MWU in SciPy is one-sided, multiply by 2 to get two-sided.
             p = mannwhitneyu_large(a, b, False) * 2
             return p >= sigLevel





More information about the llvm-commits mailing list