r84994 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84993‎ | r84994 | r84995 >
Date:01:05, 30 March 2011
Author:rfaulk
Status:deferred
Tags:
Comment:
Added reporting to confidence tests to (1) echo the python method call for the test (2) output the averaged values used for test parameters
Modified paths:
  • /trunk/fundraiser-statistics/fundraiser-scripts/compute_confidence.py (modified) (history)

Diff [purge]

Index: trunk/fundraiser-statistics/fundraiser-scripts/compute_confidence.py
@@ -262,7 +262,9 @@
263263 self.gen_plot(means_1, means_2, std_devs_1, std_devs_2, times_indices, title, xlabel, ylabel, ranges, subplot_index, labels, fname)
264264
265265 """ Print out results """
266 - self.print_metrics(test_name + '.txt', title, means_1, means_2, std_devs_1, std_devs_2, times_indices, labels)
 266+ test_call = "run_test('" + test_name + "', '" + query_name + "', '" + metric_name + "', '" + campaign + "', '" + \
 267+ item_1 + "', '" + item_2 + "', '" + start_time + "', '" + end_time + "', " + str(interval) + ", " + str(num_samples) + ")"
 268+ self.print_metrics(test_name + '.txt', title, means_1, means_2, std_devs_1, std_devs_2, times_indices, labels, test_call)
267269
268270 return
269271
@@ -326,15 +328,27 @@
327329
328330
329331 """ Print in Tabular form the means and standard deviation of each group over each interval """
330 - def print_metrics(self, filename, metric_name, means_1, means_2, std_devs_1, std_devs_2, times_indices, labels):
 332+ def print_metrics(self, filename, metric_name, means_1, means_2, std_devs_1, std_devs_2, times_indices, labels, test_call):
331333
332334 file = open(filename, 'w')
333335
334 - # Compute % increase and report
 336+ """ Compute % increase and report """
335337 av_means_1 = sum(means_1) / len(means_1)
336338 av_means_2 = sum(means_2) / len(means_2)
337339 percent_increase = math.fabs(av_means_1 - av_means_2) / min(av_means_1,av_means_2) * 100.0
338340
 341+ """ Compute the average standard deviations """
 342+ av_std_dev_1 = 0
 343+ av_std_dev_2 = 0
 344+
 345+ for i in range(len(std_devs_1)):
 346+ av_std_dev_1 = av_std_dev_1 + math.pow(std_devs_1[i], 2)
 347+ av_std_dev_2 = av_std_dev_2 + math.pow(std_devs_2[i], 2)
 348+
 349+ av_std_dev_1 = math.pow(av_std_dev_1, 0.5) / len(std_devs_1)
 350+ av_std_dev_2 = math.pow(av_std_dev_2, 0.5) / len(std_devs_1)
 351+
 352+ """ Assign the winner """
339353 if av_means_1 > av_means_2:
340354 winner = labels[0]
341355 else:
@@ -343,20 +357,38 @@
344358 win_str = "\nThe winner " + winner + " had a %.2f%s increase."
345359 win_str = win_str % (percent_increase, '%')
346360
 361+ print '\nCOMMAND = ' + test_call
 362+ file.write('\nCOMMAND = ' + test_call)
 363+
347364 print '\n\n' + metric_name
348365 print win_str
349366 print '\ninterval\tmean1\t\tmean2\t\tstddev1\t\tstddev2\n'
350367 file.write('\n\n' + metric_name)
 368+ file.write(win_str)
351369 file.write('\n\ninterval\tmean1\t\tmean2\t\tstddev1\t\tstddev2\n\n')
352 - file.write(win_str)
353370
354 - # for i in range(1,len(times_indices) - 1): -- REMOVED with the
 371+
 372+ """ Print out the parameters for each interval """
 373+
355374 for i in range(len(times_indices)):
356375 line_args = str(i) + '\t\t' + '%.5f\t\t' + '%.5f\t\t' + '%.5f\t\t' + '%.5f\n'
357376 line_str = line_args % (means_1[i], means_2[i], std_devs_1[i], std_devs_2[i])
358377 print line_str
359378 file.write(line_str)
 379+
 380+ """ Print out the averaged parameters """
 381+ line_args = '%.5f\t\t' + '%.5f\t\t' + '%.5f\t\t' + '%.5f\n'
 382+ line_str = line_args % (av_means_1, av_means_2, av_std_dev_1, av_std_dev_2)
 383+
 384+ print '\n\nOverall Parameters:\n'
 385+ print '\nmean1\t\tmean2\t\tstddev1\t\tstddev2\n'
 386+ print line_str
 387+
 388+ file.write('\n\nOverall Parameters:\n')
 389+ file.write('\nmean1\t\tmean2\t\tstddev1\t\tstddev2\n')
 390+ file.write(line_str)
360391
 392+
361393 file.close()
362394
363395

Status & tagging log