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.
This commit is contained in:
John "Elwin" Edwards 2014-01-02 13:09:48 -05:00
parent b9081d194b
commit f272772dcb
9 changed files with 14 additions and 12 deletions

10
py/stats.py Normal file → Executable file
View file

@ -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 @@ for game in rlgall.gamelist:
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()