comparison py/stats.py @ 37:c045d4dcf88a

py/stats.py: only print 3 decimal places.
author John "Elwin" Edwards
date Tue, 07 Jan 2014 21:57:33 -0500
parents 25843238434a
children
comparison
equal deleted inserted replaced
36:09ef92dc4439 37:c045d4dcf88a
26 cdf = makeExpCDF(lbd) 26 cdf = makeExpCDF(lbd)
27 print("{0}: {1} games, average {2}".format(game.name, count, int(1/lbd))) 27 print("{0}: {1} games, average {2}".format(game.name, count, int(1/lbd)))
28 for i in range(0, 10000, 1000): 28 for i in range(0, 10000, 1000):
29 actual = len([ s for s in scores if i <= s < i + 1000 ]) 29 actual = len([ s for s in scores if i <= s < i + 1000 ])
30 predicted = (cdf(i + 1000) - cdf(i)) * count 30 predicted = (cdf(i + 1000) - cdf(i)) * count
31 print("{0:5}: {1:4} {2}".format(i, actual, predicted)) 31 print("{0:5}: {1:4} {2:.3}".format(i, actual, predicted))
32 high = max(scores) 32 high = max(scores)
33 print("Max: {0} {1}\n".format(high, 1 - cdf(high))) 33 print("Max: {0} {1:.3}\n".format(high, 1 - cdf(high)))
34 34
35 cur.close() 35 cur.close()
36 conn.close() 36 conn.close()
37 exit() 37 exit()