Mercurial > hg > rlgallery-misc
diff py/stats.py @ 33:25843238434a
Change the Python module's name back to rlgall.
It is no longer an experimental variant. Using a database as a backend
is a settled feature.
author | John "Elwin" Edwards |
---|---|
date | Thu, 02 Jan 2014 13:09:48 -0500 |
parents | 5ba2123d2c20 |
children | c045d4dcf88a |
line wrap: on
line diff
--- a/py/stats.py Thu Jan 02 11:48:15 2014 -0500 +++ b/py/stats.py Thu Jan 02 13:09:48 2014 -0500 @@ -1,6 +1,8 @@ +#!/usr/bin/python3 + import math import psycopg2 -import rlgalldb as rlgall +import rlgall def makeExpPDF(lbd): def lpdf(x): @@ -22,13 +24,13 @@ total = sum(scores) lbd = float(count) / total cdf = makeExpCDF(lbd) - print "{0}: {1} games, average {2}".format(game.name, count, int(1/lbd)) + print("{0}: {1} games, average {2}".format(game.name, count, int(1/lbd))) for i in range(0, 10000, 1000): actual = len([ s for s in scores if i <= s < i + 1000 ]) predicted = (cdf(i + 1000) - cdf(i)) * count - print "{0:5}: {1:4} {2}".format(i, actual, predicted) + print("{0:5}: {1:4} {2}".format(i, actual, predicted)) high = max(scores) - print "Max: {0} {1}\n".format(high, 1 - cdf(high)) + print("Max: {0} {1}\n".format(high, 1 - cdf(high))) cur.close() conn.close()