r81081 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81080‎ | r81081 | r81082 >
Date:02:23, 27 January 2011
Author:rfaulk
Status:deferred
Tags:
Comment:
Added reporting of relative value of test winner im print_metrics method.
Modified paths:
  • /trunk/fundraiser-statistics/fundraiser-scripts/compute_confidence.py (modified) (history)

Diff [purge]

Index: trunk/fundraiser-statistics/fundraiser-scripts/compute_confidence.py
@@ -236,13 +236,8 @@
237237 std_devs_2.insert(len(std_devs_2),0)
238238 std_devs_1.insert(0,0)
239239 std_devs_2.insert(0,0)
 240+
240241
241 - #print means_1
242 - #print means_2
243 - #print std_devs_1
244 - #print std_devs_2
245 - #print times_indices
246 -
247242 # plot the results
248243 xlabel = 'Hours'
249244 subplot_index = 111
@@ -263,7 +258,7 @@
264259 self.gen_plot(means_1, means_2, std_devs_1, std_devs_2, times_indices, title, xlabel, ylabel, ranges, subplot_index, labels, fname)
265260
266261 """ Print out results """
267 - self.print_metrics(test_name + '.txt', title, means_1, means_2, std_devs_1, std_devs_2, times_indices)
 262+ self.print_metrics(test_name + '.txt', title, means_1, means_2, std_devs_1, std_devs_2, times_indices, labels)
268263
269264 return
270265
@@ -327,14 +322,29 @@
328323
329324
330325 """ Print in Tabular form the means and standard deviation of each group over each interval """
331 - def print_metrics(self, filename, metric_name, means_1, means_2, std_devs_1, std_devs_2, times_indices):
 326+ def print_metrics(self, filename, metric_name, means_1, means_2, std_devs_1, std_devs_2, times_indices, labels):
332327
333328 file = open(filename, 'w')
334329
 330+ # Compute % increase and report
 331+ av_means_1 = sum(means_1) / len(means_1)
 332+ av_means_2 = sum(means_2) / len(means_2)
 333+ percent_increase = math.fabs(av_means_1 - av_means_2) / min(av_means_1,av_means_2) * 100.0
 334+
 335+ if av_means_1 > av_means_2:
 336+ winner = labels[0]
 337+ else:
 338+ winner = labels[1]
 339+
 340+ win_str = "\nThe winner " + winner + " had a %s%.2f."
 341+ win_str = win_str % ('%', percent_increase)
 342+
335343 print '\n\n' + metric_name
 344+ print win_str
336345 print '\ninterval\tmean1\t\tmean2\t\tstddev1\t\tstddev2\n'
337346 file.write('\n\n' + metric_name)
338347 file.write('\n\ninterval\tmean1\t\tmean2\t\tstddev1\t\tstddev2\n\n')
 348+ file.write(win_str)
339349
340350 for i in range(1,len(times_indices) - 1):
341351 line_args = str(i) + '\t\t' + '%.5f\t\t' + '%.5f\t\t' + '%.5f\t\t' + '%.5f\n'

Status & tagging log