Skip to content

BUG: stats.moment_helpers does inplace modification #2928

Closed

Description

@josef-pkt

mnc2cum(m) modifies the input array inplace

just took me a while to figure out why my numbers don't match up, and keep changing.

Activity

  1. josef-pkt commented on May 7, 2016

    @josef-pkt
    MemberAuthor

    It also doesn't work correctly vectorized for 3rd and 4th cumulant

    for smmh.mc2cum

    >>> mcp
    array([[   5.,   10.,    1.],
           [   5.,   10.,    1.],
           [   5.,   10.,    1.],
           [  80.,  310.,    4.]])
    >>> np.array(smmh.mc2cum(mcp))
    array([[  5.00000000e+00,   1.00000000e+01,   1.00000000e+00],
           [  5.00000000e+00,   1.00000000e+01,   1.00000000e+00],
           [  1.30000000e+02,   1.01000000e+03,   2.00000000e+00],
           [ -1.12000000e+03,  -2.39900000e+04,   4.00000000e+00]])
    
    >>> [np.array(smmh.mc2cum(m_)) for m_ in mcp.T]
    [array([ 5.,  5.,  5.,  5.]), array([ 10.,  10.,  10.,  10.]), array([ 1.,  1.,  1.,  1.])]
    
  2. josef-pkt commented on May 8, 2016

    @josef-pkt
    MemberAuthor

    I think the vectorized bug is a consequence of inplace modification which is not a problem in the scalar case, because scalars are not mutable.

  3. zverianskii commented on Jan 6, 2017

    @zverianskii
    Contributor
  4. added a commit that references this issue on May 9, 2019
    cb620a1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions