-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
BUG: deprecation for ignored corrcoef args #5683
Conversation
This also needs a note iin |
Tests are failing |
d402c9a
to
a66fe94
Compare
Oops - should be fixed now. |
I think we can simplify this further if we add a
Then it can be used as the default value of
The argument count is then handled by python itself. |
Right - sort of like |
And then perhaps a single warning message, maybe |
Do we really want NoValue in the top-level numpy namespace? |
Also - that won't work for deprecating |
I implemented your suggestion - do you like how it looks? |
Yeah, it won't work for positional arguments. The ma.corrcoef looks OK, though.
We won't be able to remove the arguments anytime soon ;) But using |
Current version OK with you then? |
defined value. | ||
""" | ||
pass | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two blank lines ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not export this publicly? Just call it _NoValue or something? We
have enough public clutter as it is, and this adds zero value.
On Mar 14, 2015 9:15 PM, "Charles Harris" notifications@github.com wrote:
In numpy/init.py
#5683 (comment):
@@ -132,6 +132,15 @@ class VisibleDeprecationWarning(UserWarning):
pass+class NoValue:
- """Special keyword value.
- This class may be used as the default value assigned to a
- deprecated keyword in order to check if it has been given a user
- defined value.
- """
- pass
Two blank lines ;)
—
Reply to this email directly or view it on GitHub
https://github.com/numpy/numpy/pull/5683/files#r26444409.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I guess it doesn't need to be public, so _NoValue
would work.
2c98a19
to
10c28f3
Compare
@@ -1975,28 +1975,27 @@ def corrcoef(x, y=None, rowvar=1, bias=0, ddof=None): | |||
variable, with observations in the columns. Otherwise, the relationship | |||
is transposed: each column represents a variable, while the rows | |||
contain observations. | |||
bias : int, optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably keep the documentation for both of these, but just say they have no affect and are deprecated. Like so
bias :
.. deprecated:: 1.10.0
Has no affect, not used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make that
bias : NoValue, optional
.. deprecated:: 1.10.0
Has no affect, do not use.
Almost there I think. |
Can I leave it to you guys to decide on |
Yes. @rgommers Probably need a third opinion for that. |
There's just zero reason to expose it: the requirements are that it be a
|
NVM, I think using |
Do you agree we need args, kwargs in ma.corrcoef for checking for positional argument to |
@matthew-brett I don't see why they are needed, all you need to know is if the argument is used. If |
I believe we need to a) give two warnings when bias and allow_masked get used as positional arguments together and Did I miss how that can be done without using args, kwargs? |
The way I see it is that the user will always get a warning if they use I need to head off to bed now. To be continued tomorrow... |
OK - you are saying that the user will in any case infer that I don't feel strongly, happy to make the change. I currently test for the warnings in situations a, b above, but I can remove those tests. |
the number of observations; this overrides the value implied by | ||
``bias``. The default value is ``None``. | ||
If False, raises an exception. Note: as of numpy 1.10 this argument is | ||
deprecated as a positional argument and will become a keyword-only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe something like Because bias is deprecated, this argument needs to be treated as keyword only to avoid a warning
.
@matthew-brett With that change I think this would be ready. |
Add _NoValue class at top level to make it possible to detect when non-default values got passed to a keyword argument, as in: def func(a, b=np._NoValue): if b is not np._NoValue: warnings.warn("Argument b is deprecated", DeprecationWarning)
526d326
to
3171470
Compare
The bias and ddof arguments had no effect on the calculation of the correlation coefficient because the value cancels in the calculation. Deprecate these arguments to np.corrcoef and np.ma.corrcoef.
3171470
to
594c64c
Compare
BUG: deprecation for ignored corrcoef args
Merged. Thanks Matthew. |
The
ddof
andbias
arguments tocorrcoef
cancel in the math of thecorrelation coefficient, so there is no point in passing these values, and it
is confusing to the user to see these in the docstring.
Remove, deprecate, and test.
When the
bias
argument goes away, we will need to make theallow_masked
argument toma.corrcoef
into a keyword-only argument; warnabout this change.