[or-cvs] r20650: {} Add code to study pareto timeout estimation error. (torflow/trunk/CircuitAnalysis/BuildTimes)

mikeperry at seul.org mikeperry at seul.org
Wed Sep 23 01:11:08 UTC 2009


Author: mikeperry
Date: 2009-09-22 21:11:08 -0400 (Tue, 22 Sep 2009)
New Revision: 20650

Added:
   torflow/trunk/CircuitAnalysis/BuildTimes/pareto.py
Log:

Add code to study pareto timeout estimation error.



Added: torflow/trunk/CircuitAnalysis/BuildTimes/pareto.py
===================================================================
--- torflow/trunk/CircuitAnalysis/BuildTimes/pareto.py	                        (rev 0)
+++ torflow/trunk/CircuitAnalysis/BuildTimes/pareto.py	2009-09-23 01:11:08 UTC (rev 20650)
@@ -0,0 +1,34 @@
+#!/usr/bin/python
+#
+# Experiment with pareto distribution to get an idea on what the expected
+# error on alpha will do to our timeout value.
+#
+# http://en.wikipedia.org/wiki/Pareto_distribution#Parameter_estimation
+#
+# Note that alpha is not the only potential source of estimate error though.
+# With insufficient samples we may not have a valid value for Xm either.
+# I'm uncertain at this point on how to account for this or bound this error.
+import math
+
+def CalculateTimeout(Xm, alpha, q):
+  return (Xm/math.pow(1.0-q,1.0/alpha))/1000.0;
+
+sample_sizes = [100, 150, 200, 250, 300, 350, 400, 500, 600, 800, 1000]
+
+def dump_table(Xm, alpha):
+  for n in sample_sizes:
+    sigma = alpha/math.sqrt(n)
+    print "Timeouts for Xm: "+str(Xm)+", alpha: "+str(alpha)+" n:"+str(n)+" sigma: "+str(sigma)
+    print "\t -2*sigma: "+str(CalculateTimeout(Xm, alpha-2*sigma, .8))
+    print "\t -1*sigma: "+str(CalculateTimeout(Xm, alpha-sigma, .8))
+    print "\t  0*sigma: "+str(CalculateTimeout(Xm, alpha, .8))
+    print "\t +1*sigma: "+str(CalculateTimeout(Xm, alpha-1*sigma, .8))
+    print "\t +2*sigma: "+str(CalculateTimeout(Xm, alpha-2*sigma, .8))
+
+dump_table(1950, 1.4)
+print
+print
+dump_table(975, 0.9)
+
+
+


Property changes on: torflow/trunk/CircuitAnalysis/BuildTimes/pareto.py
___________________________________________________________________
Added: svn:executable
   + *



More information about the tor-commits mailing list