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

Use einsum in weighted_pearsonr #246

Merged
merged 2 commits into from
Mar 4, 2024
Merged

Use einsum in weighted_pearsonr #246

merged 2 commits into from
Mar 4, 2024

Conversation

kmdalton
Copy link
Member

This PR just optimizes rs.utils.weighted_pearsonr by replacing sequential multiplication and summation with np.einsum. This allows numpy to calculate r faster and with less memory.

@kmdalton kmdalton requested a review from JBGreisman February 27, 2024 16:44
Copy link
Member

@JBGreisman JBGreisman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep -- this makes sense to me. Feel free to merge

@JBGreisman JBGreisman added enhancement Improvement to existing feature performance Issue or pull request related to performance labels Mar 1, 2024
@kmdalton kmdalton merged commit 82c2e04 into main Mar 4, 2024
6 checks passed
@kmdalton kmdalton deleted the einsum branch March 11, 2024 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement to existing feature performance Issue or pull request related to performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants