Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

scipy.stats.scoreatpercentile backward-incompatible change not in release notes #3329

Closed
danstowell opened this Issue Feb 14, 2014 · 5 comments

Comments

Projects
None yet
4 participants

Hi - I was just bitten by a difference between scipy 0.11 and 0.13 in the behaviour of scipy.stats.scoreatpercentile. It seems to be due to 0.12 adding an "axis" argument to the function, which is great but leads to this change in behaviour:

     import numpy as np
     from scipy.stats import scoreatpercentile
     scoreatpercentile(np.eye(5), 50)

On my laptop with scipy 11.0 (and numpy 1.7.1) the answer is:

     array([ 0.,  0.,  0.,  0.,  0.])

On our lab machine with scipy 13.3 (and numpy 1.7.0) the answer is:

     0.0

I don't know the scipy development process but I believe this change should be in the release notes somewhere, though it isn't - I would suggest it should be in the 0.12 backward-incompatible changes. Does the development team update release notes for this kind of omission?

Member

josef-pkt commented Feb 14, 2014

This looks like a bug in 0.12, 0.13 to me.
scipy.stats is supposed to have and keep axis=0 as default, and not inherit or switch to the numpy default of raveling.
Data are usually in columns, traditionally in Stats

@rgommers rgommers added this to the 0.14.0 milestone Feb 14, 2014

Owner

rgommers commented Feb 27, 2014

Offending commit: 1cdd08b. Kind of painful to go back to axis=0 though, given that the current behavior has been in place for two releases and that the Notes explicitly say that this function will be replaced by np.percentile which has axis=None.

Owner

rgommers commented Feb 27, 2014

Hmm, this testcase was made with the right intention:

def test_2D(self):
    x = array([[1, 1, 1],
               [1, 1, 1],
               [4, 4, 3],
               [1, 1, 1],
               [1, 1, 1]])
    assert_array_equal(stats.scoreatpercentile(x, 50), [1, 1, 1])

Unfortunately it still passes because the scalar return broadcasts.

@rgommers rgommers modified the milestone: 0.15.0, 0.14.0 Mar 23, 2014

Member

WarrenWeckesser commented Oct 7, 2014

Kind of painful to go back to axis=0 though, given that the current behavior has been in place for two releases and that the Notes explicitly say that this function will be replaced by np.percentile which has axis=None.

Agreed. Let's leave it as is, and retroactively add a note about the change to the 0.12 release notes, as @danstowell has suggested. I'll get a PR started.

@WarrenWeckesser WarrenWeckesser added a commit to WarrenWeckesser/scipy that referenced this issue Oct 7, 2014

@WarrenWeckesser WarrenWeckesser MAINT: stats: Add note about change to scoreatpercentile in release 0…
….12.0.

Also make a test of scoreatpercentile on a 2D array more explicit
about the expected result.

Closes gh-3329.
b60daa6
Member

WarrenWeckesser commented Oct 7, 2014

Pull request is #4058

@pv pv closed this in #4058 Nov 23, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment