[or-cvs] r16851: {torflow} Add a uniform entropy measure for comparison. (torflow/branches/gsoc2008)

mikeperry at seul.org mikeperry at seul.org
Thu Sep 11 17:09:25 UTC 2008


Author: mikeperry
Date: 2008-09-11 13:09:25 -0400 (Thu, 11 Sep 2008)
New Revision: 16851

Modified:
   torflow/branches/gsoc2008/statsplitter.py
Log:

Add a uniform entropy measure for comparison.



Modified: torflow/branches/gsoc2008/statsplitter.py
===================================================================
--- torflow/branches/gsoc2008/statsplitter.py	2008-09-11 17:03:45 UTC (rev 16850)
+++ torflow/branches/gsoc2008/statsplitter.py	2008-09-11 17:09:25 UTC (rev 16851)
@@ -71,6 +71,7 @@
   exit_bw = 0.0
   pure_entropy = 0.0
   clipped_entropy = 0.0
+  uniform_entropy = 0.0
   for r in rlist:
     if not fast_rst.r_is_ok(r):
       continue
@@ -91,6 +92,7 @@
     if r.bw < 2:
       continue
     pure_entropy += (r.bw/bw)*math.log(r.bw/bw, 2)
+    uniform_entropy += (1.0/nodes)*math.log(1.0/nodes, 2)
   
     rbw = 0
     if r.bw > clipping_point:
@@ -99,6 +101,7 @@
       rbw = r.bw
     clipped_entropy += (rbw/clipped_bw)*math.log(rbw/clipped_bw, 2)
   
+  print "Uniform entropy: " + str(-uniform_entropy)
   print "Raw entropy: " + str(-pure_entropy)
   print "Clipped entropy: " + str(-clipped_entropy)
   print "Nodes: "+str(nodes)+", Exits: "+str(exits)+" Total bw: "+str(round(bw/(1024.0*1024),2))+", Exit Bw: "+str(round(exit_bw/(1024.0*1024),2))



More information about the tor-commits mailing list