Skip to content

Commit 25971c8

Browse files
committed
Deploying to gh-pages from @ 933c40d 🚀
1 parent b64eb21 commit 25971c8

File tree

531 files changed

+720
-636
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

531 files changed

+720
-636
lines changed

.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: e968cae011839ac1eba2e0b83e867117
3+
config: a14babbf9c95feafbe69bc20e146e373
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

_sources/library/asyncio-task.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,7 @@ Task Object
13201320
with :meth:`uncancel`. :class:`TaskGroup` context managers use
13211321
:func:`uncancel` in a similar fashion.
13221322

1323-
If end-user code is, for some reason, suppresing cancellation by
1323+
If end-user code is, for some reason, suppressing cancellation by
13241324
catching :exc:`CancelledError`, it needs to call this method to remove
13251325
the cancellation state.
13261326

_sources/library/statistics.rst.txt

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ The final prediction goes to the largest posterior. This is known as the
10891089
Kernel density estimation
10901090
*************************
10911091

1092-
It is possible to estimate a continuous probability density function
1092+
It is possible to estimate a continuous probability distribution
10931093
from a fixed number of discrete samples.
10941094

10951095
The basic idea is to smooth the data using `a kernel function such as a
@@ -1100,14 +1100,27 @@ which is called the *bandwidth*.
11001100

11011101
.. testcode::
11021102

1103-
def kde_normal(sample, h):
1104-
"Create a continuous probability density function from a sample."
1105-
# Smooth the sample with a normal distribution kernel scaled by h.
1106-
kernel_h = NormalDist(0.0, h).pdf
1107-
n = len(sample)
1103+
from random import choice, random
1104+
1105+
def kde_normal(data, h):
1106+
"Create a continuous probability distribution from discrete samples."
1107+
1108+
# Smooth the data with a normal distribution kernel scaled by h.
1109+
K_h = NormalDist(0.0, h)
1110+
11081111
def pdf(x):
1109-
return sum(kernel_h(x - x_i) for x_i in sample) / n
1110-
return pdf
1112+
'Probability density function. P(x <= X < x+dx) / dx'
1113+
return sum(K_h.pdf(x - x_i) for x_i in data) / len(data)
1114+
1115+
def cdf(x):
1116+
'Cumulative distribution function. P(X <= x)'
1117+
return sum(K_h.cdf(x - x_i) for x_i in data) / len(data)
1118+
1119+
def rand():
1120+
'Random selection from the probability distribution.'
1121+
return choice(data) + K_h.inv_cdf(random())
1122+
1123+
return pdf, cdf, rand
11111124

11121125
`Wikipedia has an example
11131126
<https://en.wikipedia.org/wiki/Kernel_density_estimation#Example>`_
@@ -1117,15 +1130,38 @@ a probability density function estimated from a small sample:
11171130
.. doctest::
11181131

11191132
>>> sample = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]
1120-
>>> f_hat = kde_normal(sample, h=1.5)
1133+
>>> pdf, cdf, rand = kde_normal(sample, h=1.5)
11211134
>>> xarr = [i/100 for i in range(-750, 1100)]
1122-
>>> yarr = [f_hat(x) for x in xarr]
1135+
>>> yarr = [pdf(x) for x in xarr]
11231136

11241137
The points in ``xarr`` and ``yarr`` can be used to make a PDF plot:
11251138

11261139
.. image:: kde_example.png
11271140
:alt: Scatter plot of the estimated probability density function.
11281141

1142+
`Resample <https://en.wikipedia.org/wiki/Resampling_(statistics)>`_
1143+
the data to produce 100 new selections:
1144+
1145+
.. doctest::
1146+
1147+
>>> new_selections = [rand() for i in range(100)]
1148+
1149+
Determine the probability of a new selection being below ``2.0``:
1150+
1151+
.. doctest::
1152+
1153+
>>> round(cdf(2.0), 4)
1154+
0.5794
1155+
1156+
Add a new sample data point and find the new CDF at ``2.0``:
1157+
1158+
.. doctest::
1159+
1160+
>>> sample.append(4.9)
1161+
>>> round(cdf(2.0), 4)
1162+
0.5005
1163+
1164+
11291165
..
11301166
# This modelines must appear within the last ten lines of the file.
11311167
kate: indent-width 3; remove-trailing-space on; replace-tabs on; encoding utf-8;

_sources/library/urllib.parse.rst.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ The :mod:`urllib.parse` module defines functions that fall into two broad
3131
categories: URL parsing and URL quoting. These are covered in detail in
3232
the following sections.
3333

34+
This module's functions use the deprecated term ``netloc`` (or ``net_loc``),
35+
which was introduced in :rfc:`1808`. However, this term has been obsoleted by
36+
:rfc:`3986`, which introduced the term ``authority`` as its replacement.
37+
The use of ``netloc`` is continued for backward compatibility.
38+
3439
URL Parsing
3540
-----------
3641

about.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ <h3>瀏覽</h3>
402402
<a href="https://www.python.org/psf/donations/">Please donate.</a>
403403
<br />
404404
<br />
405-
最後更新於 May 06, 2024 (09:31 UTC)。
405+
最後更新於 May 07, 2024 (07:49 UTC)。
406406

407407
<a href="/bugs.html">Found a bug</a>?
408408

bugs.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ <h2>說明文件的錯誤<a class="headerlink" href="#documentation-bugs" title=
313313
</section>
314314
<section id="getting-started-contributing-to-python-yourself">
315315
<span id="contributing-to-python"></span><h2>開始讓自己貢獻 Python<a class="headerlink" href="#getting-started-contributing-to-python-yourself" title="連結到這個標頭"></a></h2>
316-
<p>除了只是回報您所發現的錯誤之外,同樣也歡迎您提交修正它們的修補程式 (patch)。您可以在 <a class="reference external" href="https://devguide.python.org/">Python 開發者指南</a>中找到如何開始修補 Python 的更多資訊。如果您有任何問題,<a class="reference external" href="https://mail.python.org/mailman3/lists/core-mentorship.python.org/">核心導師郵寄清單</a>是一個友善的地方,您可以在那裡得到,關於 Python 修正錯誤的過程中,所有問題的答案。</p>
316+
<p>除了只是回報您所發現的錯誤之外,同樣也歡迎您提交修正它們的修補程式 (patch)。您可以在 <a class="reference external" href="https://mail.python.org/mailman3/lists/core-mentorship.python.org/">Python 開發者指南</a>中找到如何開始修補 Python 的更多資訊。如果您有任何問題,<a class="reference external" href="https://devguide.python.org/">核心導師郵寄清單</a>是一個友善的地方,您可以在那裡得到,關於 Python 修正錯誤的過程中,所有問題的答案。</p>
317317
</section>
318318
</section>
319319

@@ -441,7 +441,7 @@ <h3>瀏覽</h3>
441441
<a href="https://www.python.org/psf/donations/">Please donate.</a>
442442
<br />
443443
<br />
444-
最後更新於 May 06, 2024 (09:31 UTC)。
444+
最後更新於 May 07, 2024 (07:49 UTC)。
445445

446446
<a href="/bugs.html">Found a bug</a>?
447447

c-api/abstract.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ <h3>瀏覽</h3>
412412
<a href="https://www.python.org/psf/donations/">Please donate.</a>
413413
<br />
414414
<br />
415-
最後更新於 May 06, 2024 (09:31 UTC)。
415+
最後更新於 May 07, 2024 (07:49 UTC)。
416416

417417
<a href="/bugs.html">Found a bug</a>?
418418

c-api/allocation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ <h3>瀏覽</h3>
426426
<a href="https://www.python.org/psf/donations/">Please donate.</a>
427427
<br />
428428
<br />
429-
最後更新於 May 06, 2024 (09:31 UTC)。
429+
最後更新於 May 07, 2024 (07:49 UTC)。
430430

431431
<a href="/bugs.html">Found a bug</a>?
432432

c-api/apiabiversion.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ <h3>瀏覽</h3>
458458
<a href="https://www.python.org/psf/donations/">Please donate.</a>
459459
<br />
460460
<br />
461-
最後更新於 May 06, 2024 (09:31 UTC)。
461+
最後更新於 May 07, 2024 (07:49 UTC)。
462462

463463
<a href="/bugs.html">Found a bug</a>?
464464

c-api/arg.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ <h3>瀏覽</h3>
969969
<a href="https://www.python.org/psf/donations/">Please donate.</a>
970970
<br />
971971
<br />
972-
最後更新於 May 06, 2024 (09:31 UTC)。
972+
最後更新於 May 07, 2024 (07:49 UTC)。
973973

974974
<a href="/bugs.html">Found a bug</a>?
975975

0 commit comments

Comments
 (0)