Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: zenodo.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.7%) to scientific vocabulary
Keywords
Repository
Kernel Density Estimation in Python
Basic Info
- Host: GitHub
- Owner: tommyod
- License: bsd-3-clause
- Language: Jupyter Notebook
- Default Branch: master
- Homepage: https://kdepy.readthedocs.io/en/latest/
- Size: 11.5 MB
Statistics
- Stars: 624
- Watchers: 20
- Forks: 96
- Open Issues: 25
- Releases: 2
Topics
Metadata Files
README.md
Want to cite KDEpy in your work? See the bottom right part of this website for citation information.
KDEpy
About
This Python 3.8+ package implements various kernel density estimators (KDE).
Three algorithms are implemented through the same API: NaiveKDE, TreeKDE and FFTKDE.
The class FFTKDE outperforms other popular implementations, see the comparison page.
The code is stable and in widespread use by practitioners and in other packages.

The code generating the above graph is found in examples.py.
Installation
KDEpy is available through PyPI, and may be installed using pip:
text
pip install KDEpy
If you have trouble on Ubuntu, try running sudo apt install libpython3.X-dev, where 3.X is your Python version.
Example code and documentation
Below is an example showing an unweighted and weighted kernel density. From the code below, it should be clear how to set the kernel, bandwidth (variance of the kernel) and weights. See the documentation for more examples.
```python from KDEpy import FFTKDE import matplotlib.pyplot as plt
customer_ages = [40, 56, 20, 35, 27, 24, 29, 37, 39, 46]
Distribution of customers
x, y = FFTKDE(kernel="gaussian", bw="silverman").fit(customer_ages).evaluate() plt.plot(x, y)
Distribution of customer income (weight each customer by their income)
customer_income = [152, 64, 24, 140, 88, 64, 103, 148, 150, 132]
The bw parameter can be manually set, e.g. bw=5
x, y = FFTKDE(bw="silverman").fit(customerages, weights=customerincome).evaluate()
plt.plot(x, y)
```

The package consists of three algorithms. Here's a brief explanation:
- NaiveKDE - A naive computation. Supports d-dimensional data, variable bandwidth, weighted data and many kernel functions. Very slow on large data sets.
- TreeKDE - A tree-based computation. Supports the same features as the naive algorithm, but is faster at the expense of small inaccuracy when using a kernel without finite support. Good for evaluation on non-uniform, arbitrary grids.
- FFTKDE - A very fast convolution-based computation. Supports weighted d-dimensional data and many kernels, but not variable bandwidth. Must be evaluated on an equidistant grid, the finer the grid the higher the accuracy. Data points may not be outside of the grid.
Issues and contributing
Issues
If you are having trouble using the package, please let me know by creating an Issue on GitHub and I'll get back to you.
Contributing
Whatever your mathematical and Python background is, you are very welcome to contribute to KDEpy. To contribute, fork the project, create a branch and submit and Pull Request. Please follow these guidelines:
- Import as few external dependencies as possible.
- Use test driven development, have tests and docs for every method.
- Cite literature and implement recent methods.
- Unless it's a bottleneck computation, readability trumps speed.
- Employ object orientation, but resist the temptation to implement many methods -- stick to the basics.
- Follow PEP8.
Owner
- Name: Tommy
- Login: tommyod
- Kind: user
- Location: Oslo, Norway
- Company: @Sonat-Consulting
- Website: http://tommyodland.com/
- Repositories: 40
- Profile: https://github.com/tommyod
Partner & Senior Consultant at Sonat Consulting.
GitHub Events
Total
- Create event: 8
- Release event: 1
- Issues event: 10
- Watch event: 50
- Delete event: 8
- Issue comment event: 38
- Push event: 19
- Pull request review event: 8
- Pull request review comment event: 10
- Pull request event: 18
- Fork event: 9
Last Year
- Create event: 8
- Release event: 1
- Issues event: 10
- Watch event: 50
- Delete event: 8
- Issue comment event: 38
- Push event: 19
- Pull request review event: 8
- Pull request review comment event: 10
- Pull request event: 18
- Fork event: 9
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| tommyod | t****d@g****m | 334 |
| whitews | w****s@g****m | 11 |
| Alexandra | 8****4 | 5 |
| gle001 | g****1@s****o | 2 |
| Riccardo Di Maio | 3****o | 2 |
| yanbomb | 1****b | 1 |
| Syrtis Major | s****y@g****m | 1 |
| SergejKr | 1****r | 1 |
| Philipp Horstenkamp | p****p@h****e | 1 |
| Maximilian | 3****r | 1 |
| Martin Packman | m****n@z****m | 1 |
| Luke Dyer | 5****k | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 78
- Total pull requests: 91
- Average time to close issues: about 2 months
- Average time to close pull requests: 3 days
- Total issue authors: 68
- Total pull request authors: 15
- Average comments per issue: 2.79
- Average comments per pull request: 1.42
- Merged pull requests: 76
- Bot issues: 0
- Bot pull requests: 1
Past Year
- Issues: 7
- Pull requests: 19
- Average time to close issues: about 23 hours
- Average time to close pull requests: 6 days
- Issue authors: 6
- Pull request authors: 5
- Average comments per issue: 0.57
- Average comments per pull request: 2.53
- Merged pull requests: 16
- Bot issues: 0
- Bot pull requests: 1
Top Authors
Issue Authors
- whitews (4)
- Kaiyangshi-Ito (3)
- tommyod (2)
- NotSpecial (2)
- PhorstenkampFuzzy (2)
- psederberg (2)
- Gabriel-p (2)
- chucklesoclock (1)
- alexandrakisin (1)
- diaoyijiao (1)
- karim416 (1)
- gabrieldernbach (1)
- mdmould (1)
- suhasghorp (1)
- maxispeicher (1)
Pull Request Authors
- tommyod (65)
- snowdrop4 (5)
- whitews (3)
- OscarFlores-IFi (2)
- bean217 (2)
- rdimaio (2)
- philipp-horstenkamp (2)
- maxispeicher (2)
- yanbomb (2)
- inti-abbate (1)
- lukedyer-peak (1)
- Nauin2 (1)
- dependabot[bot] (1)
- syrte (1)
- mbaudin47 (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 36,249 last-month
- Total dependent packages: 4
- Total dependent repositories: 10
- Total versions: 38
- Total maintainers: 1
pypi.org: kdepy
Kernel Density Estimation in Python.
- Documentation: https://kdepy.readthedocs.io/
- License: BSD 3-Clause License Copyright (c) 2023, Tommy Odland Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
Latest release: 1.1.12
published 10 months ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v3 composite
- actions/setup-python v3 composite
- cython >=0.29
- ipython >=6.4.0
- matplotlib >=2.2.2
- nbsphinx >=0.3.2
- numpy >=1.14.2
- numpydoc >=0.7.0
- pytest >=3.6.2
- scipy >=1.0.1
- setuptools >=39.2.0
- numpy >=1.14.2