Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ENH: adding covariance param to corrcoef - see ticket #19852#21434

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
kpalmer29 wants to merge4 commits intonumpy:main
base:main
Choose a base branch
Loading
fromkpalmer29:function_base-corrcoef

Conversation

kpalmer29
Copy link

@kpalmer29kpalmer29 commentedMay 3, 2022
edited
Loading

Param cov was added to corrcoef func in order to accept a pre-calculated covariance matrix

@kpalmer29kpalmer29 changed the titleENH: adding covariance param to corrcoef - see ticket #19852 -draftENH: adding covariance param to corrcoef - see ticket #19852May 4, 2022
Copy link
Member

@sebergseberg left a comment

Choose a reason for hiding this comment

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

Thank you! I am not sure where the decision was standing on adding this, but it seems reasonable to me.

I added a few comments for things that need to be fixed. But the main task implementation-wise will be to add tests for the new feature and also for all the relevant error paths!

@@ -2681,14 +2681,14 @@ def cov(m, y=None, rowvar=True, bias=False, ddof=None, fweights=None,
return c.squeeze()


def _corrcoef_dispatcher(x, y=None, rowvar=None, bias=None, ddof=None, *,
def _corrcoef_dispatcher(x=None, cov = None, y=None, rowvar=None, bias=None, ddof=None, *,
Copy link
Member

Choose a reason for hiding this comment

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

The new parameter must be added at the end (or after the*, since order is irrelevant after that). In principle we could add it last, but in practice we want users to writecov=... anyway.

@@ -2728,6 +2728,9 @@ def corrcoef(x, y=None, rowvar=True, bias=np._NoValue, ddof=np._NoValue, *,

.. versionadded:: 1.20

cov : _NoValue, optional
Copy link
Member

Choose a reason for hiding this comment

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

This should be the actual type, i.e. array_like probably

@@ -2818,7 +2821,12 @@ def corrcoef(x, y=None, rowvar=True, bias=np._NoValue, ddof=np._NoValue, *,
# 2015-03-15, 1.10
warnings.warn('bias and ddof have no effect and are deprecated',
DeprecationWarning, stacklevel=3)
c = cov(x, y, rowvar, dtype=dtype)
if x is None and cov is None:
raise ValueError("'x' or 'cov' must be passed as a parameter")
Copy link
Member

Choose a reason for hiding this comment

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

This sould be aTypeError, it should be similar to what you currently get fornp.corrcoef() after all.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think you check forboth being passed. We need to check that exactly one of them is passed only.

@@ -2839,6 +2847,9 @@ def corrcoef(x, y=None, rowvar=True, bias=np._NoValue, ddof=np._NoValue, *,
return c





Copy link
Member

Choose a reason for hiding this comment

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

Please remove these additional blank lines again.

@sebergseberg added the 62 - Python APIChanges or additions to the Python API. Mailing list should usually be notified. labelMay 20, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@sebergsebergseberg left review comments

Assignees
No one assigned
Labels
01 - Enhancement62 - Python APIChanges or additions to the Python API. Mailing list should usually be notified.
Projects
Status: Pending authors' response
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@kpalmer29@seberg

[8]ページ先頭

©2009-2025 Movatter.jp