镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

ValueError: math domain error #2

Open

Description

@arg0s

Thanks for the excellent work on flask-split. At this point, the /split route is bailing out with this error. Let me know if you have any insights. I've got the latest version from pip.

2013-05-17T12:10:04.083015+00:00 app[web.1]:
2013-05-17T12:10:04.083146+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/jinja2/environment.py", line 372, in getattr
2013-05-17T12:10:04.083290+00:00 app[web.1]: return getattr(obj, attribute)
2013-05-17T12:10:04.083378+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/flask_split/models.py", line 110, in z_score
2013-05-17T12:10:04.083477+00:00 app[web.1]: return mean / sqrt(var_cr + var_crc)
2013-05-17T12:10:04.083572+00:00 app[web.1]: ValueError: math domain error

Activity

  1. jpvanhal commented on May 17, 2013

    @jpvanhal
    Owner

    It seems that var_cr + var_crc is negative in your case, which causes sqrt to raise ValueError. I don't know how this is possible since both var_cr and var_crc should always be positive. Can you check what are the values of cr, crc, n and nc variables in z_score property, when this error is raised?

  2. arg0s commented on May 17, 2013

    @arg0s
    Author

    Here you go. Let me know if you need more details.

    >>> cr = 0.0
    >>> crc = 10.3333333333
    >>> n = 3
    >>> nc = 3
    >>> 
    >>> mean = cr-crc
    >>> var_cr = cr * (1 - cr) / float(n)
    >>> var_crc = crc * (1 - crc) / float(nc)
    >>> var_cr
    0.0
    >>> var_crc
    -32.14814814792963
    >>> 
    
  3. jpvanhal commented on May 18, 2013

    @jpvanhal
    Owner

    The problem seems to be that your control alternative has more completions (31) than participations (3), which leads to crc not being between 0 and 1. I guess the reason for that is that finished() does not somehow mark the experiment as finished or the session is not saved after being modified.

    I would appreciate if you could either debug finished() and check if the experiment is properly being saved to the 'split_finished' in session, or provide a minimal code that introduces this bug.

  4. arg0s commented on May 18, 2013

    @arg0s
    Author

    Hmm OK. Does the module take care of ensuring repeat calls to finish don't
    inflate the counts or do these need to be managed so they match the ab
    calls? Users may be refreshing the finish page.
    On May 18, 2013 1:23 PM, "Janne Vanhala" notifications@github.com wrote:

    The problem seems to be that your control alternative has more completions
    (31) than participations (3), which leads to crc not being between 0 and

    1. I guess the reason for that is that finished() does not somehow mark
      the experiment as finished or the session is not saved after being
      modified.

    I would appreciate if you could either debug finished() and check if the
    experiment is properly being saved to the 'split_finished' in session, or
    provide a minimal code that introduces this bug.

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-18096807
    .

  5. jpvanhal commented on May 18, 2013

    @jpvanhal
    Owner

    Yes, the module does take care that repeating calls to finish don't inflate the counts.

  6. arg0s commented on May 18, 2013

    @arg0s
    Author

    Got it. If its fine can I have your IRC handle? I'll ping you when I'm home
    and we can figure this out.

    Arvi
    On May 18, 2013 1:45 PM, "Janne Vanhala" notifications@github.com wrote:

    Yes, the module does take care that repeating calls to finish don't
    inflate the counts.

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-18097049
    .

  7. NickWoodhams commented on Apr 28, 2015

    @NickWoodhams

    Still have this error in some circumstances. Appears the user conversion tracking may be screwing up the math. Did you solve previously?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions