Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8371799e
Commit
8371799e
authored
Aug 25, 2019
by
Raymond Hettinger
Committed by
GitHub
Aug 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-37905: Improve docs for NormalDist (GH-15486)
parent
d4b4c00b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
20 deletions
+7
-20
Doc/library/statistics.rst
Doc/library/statistics.rst
+7
-20
No files found.
Doc/library/statistics.rst
View file @
8371799e
...
@@ -667,12 +667,8 @@ of applications in statistics.
...
@@ -667,12 +667,8 @@ of applications in statistics.
.. method:: NormalDist.overlap(other)
.. method:: NormalDist.overlap(other)
Compute the `overlapping coefficient (OVL)
Returns a value between 0.0 and 1.0 giving the overlapping area for
<http://www.iceaaonline.com/ready/wp-content/uploads/2014/06/MM-9-Presentation-Meet-the-Overlapping-Coefficient-A-Measure-for-Elevator-Speeches.pdf>`_
the two probability density functions.
between two normal distributions, giving a measure of agreement.
Returns a value between 0.0 and 1.0 giving `the overlapping area for
the two probability density functions
<https://www.rasch.org/rmt/rmt101r.htm>`_.
Instances of :class:`NormalDist` support addition, subtraction,
Instances of :class:`NormalDist` support addition, subtraction,
multiplication and division by a constant. These operations
multiplication and division by a constant. These operations
...
@@ -734,16 +730,6 @@ Find the `quartiles <https://en.wikipedia.org/wiki/Quartile>`_ and `deciles
...
@@ -734,16 +730,6 @@ Find the `quartiles <https://en.wikipedia.org/wiki/Quartile>`_ and `deciles
>>> [round(sat.inv_cdf(p / 10)) for p in range(1, 10)]
>>> [round(sat.inv_cdf(p / 10)) for p in range(1, 10)]
[810, 896, 958, 1011, 1060, 1109, 1162, 1224, 1310]
[810, 896, 958, 1011, 1060, 1109, 1162, 1224, 1310]
What percentage of men and women will have the same height in `two normally
distributed populations with known means and standard deviations
<http://www.usablestats.com/lessons/normal>`_?
>>> men = NormalDist(70, 4)
>>> women = NormalDist(65, 3.5)
>>> ovl = men.overlap(women)
>>> round(ovl * 100.0, 1)
50.3
To estimate the distribution for a model than isn't easy to solve
To estimate the distribution for a model than isn't easy to solve
analytically, :class:`NormalDist` can generate input samples for a `Monte
analytically, :class:`NormalDist` can generate input samples for a `Monte
Carlo simulation <https://en.wikipedia.org/wiki/Monte_Carlo_method>`_:
Carlo simulation <https://en.wikipedia.org/wiki/Monte_Carlo_method>`_:
...
@@ -754,11 +740,12 @@ Carlo simulation <https://en.wikipedia.org/wiki/Monte_Carlo_method>`_:
...
@@ -754,11 +740,12 @@ Carlo simulation <https://en.wikipedia.org/wiki/Monte_Carlo_method>`_:
... return (3*x + 7*x*y - 5*y) / (11 * z)
... return (3*x + 7*x*y - 5*y) / (11 * z)
...
...
>>> n = 100_000
>>> n = 100_000
>>> X = NormalDist(10, 2.5).samples(n)
>>> seed = 86753099035768
>>> Y = NormalDist(15, 1.75).samples(n)
>>> X = NormalDist(10, 2.5).samples(n, seed=seed)
>>> Z = NormalDist(5, 1.25).samples(n)
>>> Y = NormalDist(15, 1.75).samples(n, seed=seed)
>>> Z = NormalDist(50, 1.25).samples(n, seed=seed)
>>> NormalDist.from_samples(map(model, X, Y, Z)) # doctest: +SKIP
>>> NormalDist.from_samples(map(model, X, Y, Z)) # doctest: +SKIP
NormalDist(mu=1
9.640137307085507, sigma=47.03273142191088
)
NormalDist(mu=1
.8661894803304777, sigma=0.65238717376862
)
Normal distributions commonly arise in machine learning problems.
Normal distributions commonly arise in machine learning problems.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment