Mercurial Hosting > traffic-intelligence
comparison python/utils.py @ 77:5e6cd36a991c
added pretty print in empiricalDistribution
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 10 Feb 2011 22:41:38 -0500 |
parents | 64fde2b1f96d |
children | 7f1e54234f96 |
comparison
equal
deleted
inserted
replaced
76:64fde2b1f96d | 77:5e6cd36a991c |
---|---|
65 refProba.append(refCumulativeCounts[i]-refCumulativeCounts[i-1]) | 65 refProba.append(refCumulativeCounts[i]-refCumulativeCounts[i-1]) |
66 refProba.append(1-refCumulativeCounts[-1]) | 66 refProba.append(1-refCumulativeCounts[-1]) |
67 refCounts = [p*self.nSamples() for p in refProba] | 67 refCounts = [p*self.nSamples() for p in refProba] |
68 | 68 |
69 return refCounts, refProba | 69 return refCounts, refProba |
70 | |
71 def printReferenceCounts(self, refCounts=None): | |
72 if refCounts: | |
73 ref = refCounts | |
74 else: | |
75 ref = self.referenceCounts | |
76 for i in xrange(len(ref[0])): | |
77 print('{0}-{1} & {2:0.3} & {3:0.3} \\\\'.format(self.categories[i],self.categories[i+1],ref[1][i], ref[0][i])) | |
78 | |
70 | 79 |
71 ######################### | 80 ######################### |
72 # maths section | 81 # maths section |
73 ######################### | 82 ######################### |
74 | 83 |