Refactor (mostly rearrange) the statistics module (gh-119930)

This commit is contained in:
Raymond Hettinger 2024-06-01 22:07:46 -05:00 committed by GitHub
parent c618f7d80e
commit e378dc15b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 808 additions and 760 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2435,12 +2435,13 @@ class TestKDE(unittest.TestCase):
self.assertGreater(f_hat(100), 0.0)
def test_kde_kernel_invcdfs(self):
kernel_invcdfs = statistics._kernel_invcdfs
kernel_specs = statistics._kernel_specs
kde = statistics.kde
# Verify that cdf / invcdf will round trip
xarr = [i/100 for i in range(-100, 101)]
for kernel, invcdf in kernel_invcdfs.items():
for kernel, spec in kernel_specs.items():
invcdf = spec['invcdf']
with self.subTest(kernel=kernel):
cdf = kde([0.0], h=1.0, kernel=kernel, cumulative=True)
for x in xarr: