Skip to content

[MRG] add fast replacement for np.cov #5344

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

Closed
wants to merge 1 commit into from

Conversation

larsmans
Copy link
Member

@larsmans larsmans commented Oct 5, 2015

This is inspired by some recent PRs over at NumPy concerning np.cov performance.

Timings with NumPy 1.8.2 and ATLAS:

>>> X = np.random.rand(13000,60)
>>> %timeit np.cov(X)
1 loops, best of 3: 2.82 s per loop
>>> %timeit fast_cov(X)
1 loops, best of 3: 1.71 s per loop

Memory use is also halved compared to NumPy <= 1.10, at least for n_samplesn_features. NumPy 1.11 will have a more memory-efficient cov implementation.

Timings with NumPy 1.8.2 and ATLAS:

    >>> X = np.random.rand(13000,60)
    >>> %timeit np.cov(X)
    1 loops, best of 3: 2.82 s per loop
    >>> %timeit fast_cov(X)
    1 loops, best of 3: 1.71 s per loop

Memory use is also halved compared to NumPy <= 1.10, at least for
n_samples >> n_features. NumPy 1.11 will have a more memory-efficient
cov implementation.
@amueller
Copy link
Member

tests are failing... otherwise looks like a good idea.

@amueller amueller mentioned this pull request Oct 12, 2015
16 tasks
This function is faster and more memory-efficient than np.cov
(at least as of NumPy 1.10; 1.11 will receive similar optimizations).

Based on the NumPy version.
Copy link
Contributor

Choose a reason for hiding this comment

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

Dont want to be picky, but shouldnt bias and rowvar be documented?

@rth
Copy link
Member

rth commented Jun 14, 2019

This function is faster and more memory-efficient than np.cov
(at least as of NumPy 1.10; 1.11 will receive similar optimizations).

Since numpy 1.11 is now the minimal requirement this PR becomes unnecessary. Closing.

@rth rth closed this Jun 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants