r81078 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81077‎ | r81078 | r81079 >
Date:01:05, 27 January 2011
Author:rfaulk
Status:deferred
Tags:
Comment:
fixed a bug in partitioning data the data for confidence analysis.
Modified paths:
  • /trunk/fundraiser-statistics/fundraiser-scripts/compute_confidence.py (modified) (history)

Diff [purge]

Index: trunk/fundraiser-statistics/fundraiser-scripts/compute_confidence.py
@@ -78,6 +78,8 @@
7979 formatted_sql_stmnt_1 = query_obj.format_query(query_name, sql_stmnt, [t1, t2, item_1, campaign])
8080 formatted_sql_stmnt_2 = query_obj.format_query(query_name, sql_stmnt, [t1, t2, item_2, campaign])
8181
 82+ # print formatted_sql_stmnt_1
 83+
8284 try:
8385 err_msg = formatted_sql_stmnt_1
8486
@@ -92,9 +94,6 @@
9395 self.db.rollback()
9496 sys.exit("Database Interface Exception:\n" + err_msg)
9597
96 - #print results_1[metric_index]
97 - #print results_2[metric_index]
98 -
9998 metrics_1.append(results_1[metric_index])
10099 metrics_2.append(results_2[metric_index])
101100
@@ -260,6 +259,7 @@
261260
262261 ylabel = metric_name
263262 labels = [item_1, item_2]
 263+
264264 self.gen_plot(means_1, means_2, std_devs_1, std_devs_2, times_indices, title, xlabel, ylabel, ranges, subplot_index, labels, fname)
265265
266266 """ Print out results """
@@ -301,7 +301,7 @@
302302 var2 = 0 # variance of group 2
303303
304304 for j in range(num_samples):
305 - index = i + j
 305+ index = i * num_samples + j
306306
307307 # Compute mean for each group
308308 m1 = m1 + metrics_1[index]
@@ -488,9 +488,9 @@
489489
490490 """ lookup confidence """
491491
492 - print ''
493 - print t
494 - print degrees_of_freedom
 492+ #print ''
 493+ #print t
 494+ #print degrees_of_freedom
495495
496496 # get t and df
497497 degrees_of_freedom = math.ceil(degrees_of_freedom)
@@ -504,14 +504,17 @@
505505 try:
506506 self.cur.execute(select_stmnt)
507507 results = self.cur.fetchone()
508 -
509 - p = float(results[0])
 508+
 509+ if results[0] != None:
 510+ p = float(results[0])
 511+ else:
 512+ p = .0005
510513 except:
511514 self.db.rollback()
512515 self.db.close()
513516 sys.exit('Could not execute: ' + select_stmnt)
514 -
515 - print p
 517+
 518+ #print p
516519 self.db.close()
517520
518521 conf_str = str((1 - p) * 100) + '% confident about the winner.'

Status & tagging log