Mercurial Hosting > traffic-intelligence
changeset 876:c7e72d758049
minor update to avoid integer issue
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 08 Mar 2017 17:05:29 -0500 |
parents | 45384b45e35a |
children | d1ff6917d082 |
files | python/utils.py |
diffstat | 1 files changed, 1 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/python/utils.py Wed Feb 15 14:59:57 2017 -0500 +++ b/python/utils.py Wed Mar 08 17:05:29 2017 -0500 @@ -82,10 +82,7 @@ def computeChi2(expected, observed): '''Returns the Chi2 statistics''' - result = 0. - for e, o in zip(expected, observed): - result += ((e-o)*(e-o))/e - return result + return sum([((e-o)*(e-o))/float(e) for e, o in zip(expected, observed)]) class DistributionSample(object): def nSamples(self):