Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-115532: Add kernel density estimation to the statistics module#115863

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
rhettinger merged 19 commits intopython:mainfromrhettinger:kde
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
19 commits
Select commitHold shift + click to select a range
2a5841d
Add docs and code for kde()
rhettingerFeb 23, 2024
940795f
Alphabetize the function order
rhettingerFeb 23, 2024
482c9c1
Add blurb
rhettingerFeb 23, 2024
e9386ed
Add PDF area test
rhettingerFeb 23, 2024
c3ddb1e
Add tests
rhettingerFeb 23, 2024
a2771cb
Early test for non-numeric data. Tests for name and docstring
rhettingerFeb 23, 2024
e29d64f
Use StatisticsError for invalid kernels
rhettingerFeb 23, 2024
5d8bab0
.
rhettingerFeb 23, 2024
9e6aaa7
Add kde() to __all__
rhettingerFeb 23, 2024
c8b19d8
Add test for non-sequence input
rhettingerFeb 23, 2024
d571452
Fix markup for external link
rhettingerFeb 23, 2024
ddc32b8
Remove outdated KDE recipe
rhettingerFeb 23, 2024
5ac1055
Improve variable names in integration using the midpoint rule.
rhettingerFeb 24, 2024
24e38e2
Improve appearance of generated docstring
rhettingerFeb 24, 2024
e729127
Put the kernel names in italics
rhettingerFeb 24, 2024
e6d6e0f
Add a whatsnew entry
rhettingerFeb 24, 2024
b3fd269
Add test for support interval boundary conditions
rhettingerFeb 25, 2024
9dec308
Sync the docstring with the main docs.
rhettingerFeb 25, 2024
771a232
Fix missing angle bracket markup
rhettingerFeb 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Sync the docstring with the main docs.
  • Loading branch information
@rhettinger
rhettinger committedFeb 25, 2024
commit9dec3087eb271a54fd8eb8190b66ea467d028039
11 changes: 5 additions & 6 deletionsDoc/library/statistics.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -264,13 +264,12 @@ However, for reading convenience, most of the examples show sorted sequences.
.. function:: kde(data, h, kernel='normal')

`Kernel Density Estimation (KDE)
<https://www.itm-conferences.org/articles/itmconf/pdf/2018/08/itmconf_sam2018_00037.pdf>`_
creates an estimated continuous probability density function from *data*
containing a fixed number of discrete samples.
<https://www.itm-conferences.org/articles/itmconf/pdf/2018/08/itmconf_sam2018_00037.pdf>`_:
Create a continuous probability density function from discrete samples.

The basic idea is to smooth the data using `a kernel function such as a
normal distribution, triangular distribution, or uniform distribution
<https://en.wikipedia.org/wiki/Kernel_(statistics)#Kernel_functions_in_common_use>`_.
The basic idea is to smooth the data using `a kernel function
<https://en.wikipedia.org/wiki/Kernel_(statistics)`_.
to help draw inferences about a population from a sample.

The degree of smoothing is controlled by the scaling parameter *h*
which is called the bandwidth. Smaller values emphasize local
Expand Down
6 changes: 6 additions & 0 deletionsLib/statistics.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -814,6 +814,10 @@ def kde(data, h, kernel='normal'):
which is called the bandwidth. Smaller values emphasize local
features while larger values give smoother results.

The kernel determines the relative weights of the sample data
points. Generally, the choice of kernel shape does not matter
as much as the more influential bandwidth smoothing parameter.

Kernels that give some weight to every sample point:

normal or gauss
Expand All@@ -830,6 +834,8 @@ def kde(data, h, kernel='normal'):
triweight
cosine

A StatisticsError will be raised if the data sequence is empty.

Example
-------

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp