Skip to content

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

Closed
larsmans wants to merge 1 commit intoscikit-learn:masterfrom
larsmans:fast-cov
Closed

[MRG] add fast replacement for np.cov#5344
larsmans wants to merge 1 commit intoscikit-learn:masterfrom
larsmans:fast-cov

Conversation

@larsmans
Copy link
Copy Markdown
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
Copy Markdown
Member

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

@amueller amueller mentioned this pull request Oct 12, 2015
16 tasks
Copy link
Copy Markdown
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
Copy Markdown
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