Issue40290
Created on 2020-04-15 03:14 by rhettinger, last changed 2020-04-16 17:25 by rhettinger. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 19547 | merged | rhettinger, 2020-04-15 23:46 | |
| Messages (3) | |||
|---|---|---|---|
| msg366484 - (view) | Author: Raymond Hettinger (rhettinger) * | Date: 2020-04-15 03:14 | |
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
|
|||
| msg366571 - (view) | Author: Raymond Hettinger (rhettinger) * | Date: 2020-04-15 23:49 | |
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. |
|||
| msg366611 - (view) | Author: Raymond Hettinger (rhettinger) * | Date: 2020-04-16 17:25 | |
New changeset 70f027dd22d6522b777d10c250f951e5e416b93a by Raymond Hettinger in branch 'master': bpo-40290: Add zscore() to statistics.NormalDist. (GH-19547) https://github.com/python/cpython/commit/70f027dd22d6522b777d10c250f951e5e416b93a |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2020-04-16 17:25:41 | rhettinger | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2020-04-16 17:25:24 | rhettinger | set | messages: + msg366611 |
| 2020-04-15 23:49:07 | rhettinger | set | messages:
+ msg366571 title: Add z_score to statistics.NormalDist -> Add zscore to statistics.NormalDist |
| 2020-04-15 23:46:44 | rhettinger | set | keywords:
+ patch stage: patch review pull_requests: + pull_request18893 |
| 2020-04-15 03:14:09 | rhettinger | create | |