[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [metrics-web/release] Simplify censorship detector.



commit 27fe3f3b504ec59af6e4ea1bab9f991ef84be908
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Tue May 15 20:25:39 2018 +0200

    Simplify censorship detector.
    
    As part of the censorship detector, we're currently fitting a normal
    distribution to a set of approximately 50 values.
    
    After talking to George Danezis, the original author of our censorship
    detector, it's safe to approximate this step by computing the mean and
    standard deviation of these values and using those to parameterize the
    normal distribution.
    
    A test run with today's numbers produced the exact same result.
    
    The main benefit of this simplification is that it will be easier for
    others to reproduce our numbers, even without a statistics library as
    powerful as SciPy.
---
 src/main/python/clients/detector.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/main/python/clients/detector.py b/src/main/python/clients/detector.py
index 3d17bf0..9944710 100644
--- a/src/main/python/clients/detector.py
+++ b/src/main/python/clients/detector.py
@@ -43,6 +43,7 @@ import matplotlib
 
 # Dep: numpy
 import numpy
+from numpy import mean, std
 
 # Dep: scipy
 import scipy.stats
@@ -199,7 +200,8 @@ def make_tendencies_minmax(l, INTERVAL = 1):
         minx += [None]
         maxx += [None]
         continue
-      mu, signma = norm.fit(vals)
+      mu = mean(vals)
+      signma = std(vals)
       dists += [(mu, signma)]
       maxx += [norm.ppf(0.9999, mu, signma)]
       minx += [norm.ppf(1 - 0.9999, mu, signma)]



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits