Skip to content

Commit

Permalink
Test the curve in more places
Browse files Browse the repository at this point in the history
  • Loading branch information
rhettinger committed May 4, 2024
1 parent a4692bf commit ec2d9f2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Lib/test/test_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2479,7 +2479,7 @@ def test_kde_random(self):
self.assertIn(kernel, prng.__doc__)
self.assertIn(repr(h), prng.__doc__)

# Approximate distribution test
# Approximate distribution test: Compare a random sample to expected distribution

data = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2, 7.8, 14.3, 15.1, 15.3, 15.8, 17.0]
n = 1_000_000
Expand All @@ -2502,7 +2502,8 @@ def p_observed(x):
rand = kde_random(data, h, kernel, seed=8675309**2)
big_sample = sorted([rand() for i in range(n)])

for x in range(-4, 19):
for x in range(-40, 190):
x /= 10
self.assertTrue(math.isclose(p_observed(x), p_expected(x), abs_tol=0.001))


Expand Down

0 comments on commit ec2d9f2

Please sign in to comment.