Skip to content
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

Improve speed and accuracy for correlation() #26135

Merged
merged 16 commits into from
May 15, 2021

Conversation

rhettinger
Copy link
Contributor

This is the same as the previous improvement to linear_regression().

  • Repeated computation of xbar and ybar factored-out to a single computation each.
  • Two unnecessary divisions by n - 1 factored-out, making it faster and avoiding two roundings.
  • Only one sqrt() call instead of two , making it faster and avoiding one extra rounding.

Also changed variable name in covariance() to be consistent with the other two functions.

rhettinger and others added 13 commits March 15, 2021 21:12
.
Merge branch 'master' of github.com:python/cpython
.
Merge branch 'master' of github.com:python/cpython
.
Merge branch 'master' of github.com:python/cpython
.
Merge branch 'master' of github.com:python/cpython
Merge branch 'main' of github.com:python/cpython into main
Merge branch 'main' of github.com:python/cpython
@rhettinger rhettinger merged commit fdfea4a into python:main May 15, 2021
@rhettinger rhettinger added the needs backport to 3.10 only security fixes label May 15, 2021
@miss-islington
Copy link
Contributor

Thanks @rhettinger for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-26151 is a backport of this pull request to the 3.10 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance or resource usage skip issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants