annotate distr_2.py @ 59:c22f83e049a9 simple

check0 works for nono10, but is broken in that col 3 w/o the row 7 hit would find the row 3 hit as satisfying the last (2nd) run, which isn't _necessarily_ correct
author Henry Thompson <ht@markup.co.uk>
date Sat, 03 Jun 2023 22:11:12 +0100
parents bb46148fab91
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28
bb46148fab91 second half of old /c/Drive_F/merged_d/src/python/distr.py, modified to do coin flip experiment
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
1 # experimenting with distributions
bb46148fab91 second half of old /c/Drive_F/merged_d/src/python/distr.py, modified to do coin flip experiment
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
2 # Usage: distr.py N bucketWidth max
bb46148fab91 second half of old /c/Drive_F/merged_d/src/python/distr.py, modified to do coin flip experiment
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
3 import sys, random, signif
bb46148fab91 second half of old /c/Drive_F/merged_d/src/python/distr.py, modified to do coin flip experiment
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
4 from nltk import FreqDist
bb46148fab91 second half of old /c/Drive_F/merged_d/src/python/distr.py, modified to do coin flip experiment
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
5
bb46148fab91 second half of old /c/Drive_F/merged_d/src/python/distr.py, modified to do coin flip experiment
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
6 mu=float(sys.argv[1])
bb46148fab91 second half of old /c/Drive_F/merged_d/src/python/distr.py, modified to do coin flip experiment
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
7 sigma=float(sys.argv[2])
bb46148fab91 second half of old /c/Drive_F/merged_d/src/python/distr.py, modified to do coin flip experiment
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
8 n=int(sys.argv[3])
bb46148fab91 second half of old /c/Drive_F/merged_d/src/python/distr.py, modified to do coin flip experiment
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
9 scale=float(sys.argv[4])
bb46148fab91 second half of old /c/Drive_F/merged_d/src/python/distr.py, modified to do coin flip experiment
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
10 fd=FreqDist()
bb46148fab91 second half of old /c/Drive_F/merged_d/src/python/distr.py, modified to do coin flip experiment
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
11 fd2=FreqDist()
bb46148fab91 second half of old /c/Drive_F/merged_d/src/python/distr.py, modified to do coin flip experiment
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
12 for i in xrange(n):
bb46148fab91 second half of old /c/Drive_F/merged_d/src/python/distr.py, modified to do coin flip experiment
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
13 fd[round(random.normalvariate(mu,sigma)/scale)]+=1
bb46148fab91 second half of old /c/Drive_F/merged_d/src/python/distr.py, modified to do coin flip experiment
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
14 fd2[round(random.gauss(mu,sigma)/scale)]+=1
bb46148fab91 second half of old /c/Drive_F/merged_d/src/python/distr.py, modified to do coin flip experiment
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
15 fd.bell(xtra=fd2)