Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
GH-102670: Use sumprod() to simplify, speed up, and improve accuracy of statistics functions#102649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
GH-102670: Use sumprod() to simplify, speed up, and improve accuracy of statistics functions #102649
Changes from all commits
3f2fd8d324104552c758416b2745b9eeee5c51e52039be9f8a448615c9a4e4d5fe1be545ffe7eFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| """Test suite for statistics module, including helper NumericTestCase and | ||
| x = """Test suite for statistics module, including helper NumericTestCase and | ||
| ||
| approx_equal function. | ||
| """ | ||
| @@ -2610,6 +2610,16 @@ def test_proportional(self): | ||
| self.assertAlmostEqual(slope, 20 + 1/150) | ||
| self.assertEqual(intercept, 0.0) | ||
| def test_float_output(self): | ||
| x = [Fraction(2, 3), Fraction(3, 4)] | ||
| y = [Fraction(4, 5), Fraction(5, 6)] | ||
| slope, intercept = statistics.linear_regression(x, y) | ||
| self.assertTrue(isinstance(slope, float)) | ||
| self.assertTrue(isinstance(intercept, float)) | ||
| slope, intercept = statistics.linear_regression(x, y, proportional=True) | ||
| self.assertTrue(isinstance(slope, float)) | ||
| self.assertTrue(isinstance(intercept, float)) | ||
| class TestNormalDist: | ||
| # General note on precision: The pdf(), cdf(), and overlap() methods | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Optimized fmean(), correlation(), covariance(), and linear_regression() | ||
| using the new math.sumprod() function. |
Uh oh!
There was an error while loading. Please reload this page.