Commit Graph

15 Commits

Author SHA1 Message Date
ShaharNaveh
a9c98d2666 Update statistics.py from 3.14.3 2026-02-11 18:01:41 +09:00
Jeong, YunWon
1b17587585 __slots__ xor __dict__ , name mangling (#6392)
* __slots__ xor __dict__

* mangle_name for `__` prefixed members
2025-12-10 23:30:10 +09:00
Jack O'Connor
4079776c36 Add kde function and tests to RustPython statistics module (#6030)
* Copy CPython 3.13 statistics module into RustPython

* Adjust CPython "magic constants" in KDE tests

## test_kde

I'm not too sure why but this one takes a few seconds to run the second
for loop which calculates the cumulative distribution and does a rough
calculation of the area under the curve.

## test_kde_random

I have a lower bound for RustPython to sort a random list of 1_000_000
numbers on my laptop of > 1 hour. By dropping n to 30_000 sort will not
take an egregious amount of time to run. It is then necessary to lower
the tolerance for the math.isclose check, or the computed values may
**randomly** fail due to the higher variance caused by the smaller
sample size.

* Reintroduce expected failure in test_statistics.TestNormalDict.test_slots

* Sync Rust `normal_dist_inv_cdf` with Python equivalent

See https://github.com/python/cpython/pull/95265.

To quote:
> Restores alignment with random.gauss(mu, sigma) and
random.normalvariate(mu, sigma) both. of which are equivalent to
sampling from NormalDist(mu, sigma).inv_cdf(random()). The two functions
in the random module happy accept sigma=0 and give a well-defined
result.

> This also lets the function gently handle a sigma getting smaller,
eventually becoming zero. As sigma decrease, NormalDist(mu,
sigma).inv_cdf(p) forms a tighter and tighter internal around mu and
becoming exactly mu in the limit. For example, NormalDist(100,
1E-300).inv_cdf(0.3) cleanly evaluates to 100.0but withsigma=1e-500``
the function previously would raised an unexpected error.
2025-07-26 00:42:22 +09:00
Ashwin Naren
7fab64ed9c Revert "Update statistics to 3.13.2 (#5592)" (#5606)
This reverts commit ff970b0e1c.
2025-03-14 11:41:14 +09:00
Ashwin Naren
ff970b0e1c Update statistics to 3.13.2 (#5592)
* statistics to 3.13.2

* set flaky test
2025-03-11 22:37:26 +09:00
bearney74
123559478e fix fmean/fsum ValueError and test_inv_cdf 2023-03-17 01:18:47 +09:00
Devon Hollowood
893f86e9cf Respond to reviewer comments 2022-10-23 10:17:43 -07:00
Gyubong
773066f2dd Remove expectedFailure 2022-10-04 17:28:00 +09:00
Padraic Fanning
9b6155cf87 Unmark passing test 2022-02-12 23:51:47 -05:00
Padraic Fanning
0f1cdedf73 Update test_statistics.py to CPython 3.10 2022-02-12 23:31:00 -05:00
Dean Li
6f98288e84 test: use import_helper 2021-11-29 21:03:02 +08:00
Tetramad
3d8f6cf08d Fix math.log to pass some failed tests
Now math.log with less than or equal to zero should raise ValueError
with "math domain error" message if `x` fit in f64
2021-10-25 14:44:08 +09:00
voidSatisfaction
67ede59c32 Add math.prod function and enable its tests 2021-08-15 23:20:28 +09:00
boris
83a64ad318 mark failing tests 2021-02-03 01:14:49 -05:00
boris
b767f13994 Copied statistics from CPython 3.8 2021-02-01 15:04:47 -05:00