Skip to content
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

Add zscore to statistics.NormalDist #84470

Closed
rhettinger opened this issue Apr 15, 2020 · 3 comments
Closed

Add zscore to statistics.NormalDist #84470

rhettinger opened this issue Apr 15, 2020 · 3 comments
Assignees
Labels
3.9 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@rhettinger
Copy link
Contributor

BPO 40290
Nosy @rhettinger, @stevendaprano
PRs
  • bpo-40290: Add zscore() to statistics.NormalDist. #19547
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/rhettinger'
    closed_at = <Date 2020-04-16.17:25:41.221>
    created_at = <Date 2020-04-15.03:14:09.048>
    labels = ['type-feature', 'library', '3.9']
    title = 'Add zscore to statistics.NormalDist'
    updated_at = <Date 2020-04-16.17:25:41.221>
    user = 'https://github.com/rhettinger'

    bugs.python.org fields:

    activity = <Date 2020-04-16.17:25:41.221>
    actor = 'rhettinger'
    assignee = 'rhettinger'
    closed = True
    closed_date = <Date 2020-04-16.17:25:41.221>
    closer = 'rhettinger'
    components = ['Library (Lib)']
    creation = <Date 2020-04-15.03:14:09.048>
    creator = 'rhettinger'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40290
    keywords = ['patch']
    message_count = 3.0
    messages = ['366484', '366571', '366611']
    nosy_count = 2.0
    nosy_names = ['rhettinger', 'steven.daprano']
    pr_nums = ['19547']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue40290'
    versions = ['Python 3.9']

    @rhettinger
    Copy link
    Contributor Author

    I've had a couple of requests for a z-score method, once to produce an actual z-score for output and another as a way of normalizing gaussian inputs for machine learning.

    Proposed:

        >>> iq = NormalDist(100, 15)
        >>> iq.zscore(142)
        2.8

    Same result as:

        >>> (142 - iq.mean) / iq.stdev
        2.8

    There is some question about whether to name it zscore or z_score. Numpy uses zscore but numpy tends to scrunch names where we would tend to spell them out or use an underscore for readability.

    See: https://en.wikipedia.org/wiki/Standard_score

    @rhettinger rhettinger added the 3.9 only security fixes label Apr 15, 2020
    @rhettinger rhettinger self-assigned this Apr 15, 2020
    @rhettinger rhettinger added stdlib Python modules in the Lib dir type-feature A feature request or enhancement 3.9 only security fixes labels Apr 15, 2020
    @rhettinger rhettinger self-assigned this Apr 15, 2020
    @rhettinger rhettinger added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Apr 15, 2020
    @rhettinger
    Copy link
    Contributor Author

    Trying out various names in code examples, zscore() was a clear winner over z_score(). Also, the name matches what is used in R and numpy.

    @rhettinger rhettinger changed the title Add z_score to statistics.NormalDist Add zscore to statistics.NormalDist Apr 15, 2020
    @rhettinger rhettinger changed the title Add z_score to statistics.NormalDist Add zscore to statistics.NormalDist Apr 15, 2020
    @rhettinger
    Copy link
    Contributor Author

    New changeset 70f027d by Raymond Hettinger in branch 'master':
    bpo-40290: Add zscore() to statistics.NormalDist. (GH-19547)
    70f027d

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant