Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def test_chi(seq):
- K = 1000
- n = len(seq)
- p = np.array([1.0 / K for i in range(K)])
- v = np.zeros(K)
- for el in seq:
- v[int(el * K)] += 1
- chi2 = np.sum([(v[k] - n * p[k]) ** 2 / (n * p[k]) for k in range(K)])
- thres = stats.chi2.ppf(1-eps_0, K - 1)
- if chi2 < thres:
- ans = Fore.GREEN + 'H0' + Fore.BLACK
- else:
- ans = Fore.RED + 'H1' + Fore.BLACK
- return chi2, thres, ans
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement