{"id":13687799,"url":"https://github.com/tommyod/KDEpy","last_synced_at":"2025-05-01T15:32:38.991Z","repository":{"id":41243415,"uuid":"118142261","full_name":"tommyod/KDEpy","owner":"tommyod","description":"Kernel Density Estimation in Python","archived":false,"fork":false,"pushed_at":"2025-04-17T21:04:47.000Z","size":12087,"stargazers_count":610,"open_issues_count":24,"forks_count":93,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-04-18T10:51:39.275Z","etag":null,"topics":["data-analysis","exploratory-data-analysis","kernel-density-estimation","python","python3","statistics"],"latest_commit_sha":null,"homepage":"https://kdepy.readthedocs.io/en/latest/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tommyod.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-01-19T15:27:57.000Z","updated_at":"2025-04-18T08:35:56.000Z","dependencies_parsed_at":"2023-01-25T17:01:32.050Z","dependency_job_id":"e8c104e5-40fb-481f-8b84-90aa61d081a3","html_url":"https://github.com/tommyod/KDEpy","commit_stats":{"total_commits":347,"total_committers":9,"mean_commits":38.55555555555556,"dds":0.2276657060518732,"last_synced_commit":"b578ec509a562fc25c8e02ae1f16e3c18c247ccb"},"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommyod%2FKDEpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommyod%2FKDEpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommyod%2FKDEpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommyod%2FKDEpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tommyod","download_url":"https://codeload.github.com/tommyod/KDEpy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251898969,"owners_count":21661925,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-analysis","exploratory-data-analysis","kernel-density-estimation","python","python3","statistics"],"created_at":"2024-08-02T15:01:00.771Z","updated_at":"2025-05-01T15:32:33.982Z","avatar_url":"https://github.com/tommyod.png","language":"Jupyter Notebook","readme":"[![DOI](https://zenodo.org/badge/118142261.svg)](https://zenodo.org/badge/latestdoi/118142261)\n[![Build \u0026 test (master)](https://github.com/tommyod/KDEpy/actions/workflows/test_master.yml/badge.svg)](https://github.com/tommyod/KDEpy/actions/workflows/test_master.yml)\n[![Documentation Status](https://readthedocs.org/projects/kdepy/badge/?version=latest)](http://kdepy.readthedocs.io/en/latest/?badge=latest)\n[![PyPI version](https://badge.fury.io/py/KDEpy.svg)](https://badge.fury.io/py/KDEpy)\n[![Downloads](https://pepy.tech/badge/kdepy)](https://pepy.tech/project/kdepy)\n---------\n\nWant to cite KDEpy in your work? See the [bottom right part of this website](https://zenodo.org/record/2392268) for citation information.\n\n# [KDEpy](https://kdepy.readthedocs.io/en/latest/)\n\n## About\n\nThis Python 3.8+ package implements various kernel density estimators (KDE).\nThree algorithms are implemented through the same API: [`NaiveKDE`](https://kdepy.readthedocs.io/en/latest/API.html#naivekde), [`TreeKDE`](https://kdepy.readthedocs.io/en/latest/API.html#treekde) and [`FFTKDE`](https://kdepy.readthedocs.io/en/latest/API.html#fftkde).\nThe class [`FFTKDE`](https://kdepy.readthedocs.io/en/latest/API.html#fftkde) outperforms other popular implementations, see the [comparison page](https://kdepy.readthedocs.io/en/latest/comparison.html).\n**The code is stable and in widespread use by practitioners and in other packages.**\n\n![Plot](https://raw.githubusercontent.com/tommyod/KDEpy/master/docs/source/_static/img/showcase.png)\n\n*The code generating the above graph is found in [examples.py](https://github.com/tommyod/KDEpy/blob/master/docs/source/examples.py).*\n\n## Installation\n\nKDEpy is available through [PyPI](https://pypi.org/project/KDEpy/), and may be installed using `pip`:\n\n```text\npip install KDEpy\n```\n\nIf you have [trouble on Ubuntu](https://github.com/tommyod/KDEpy/issues/11), try running `sudo apt install libpython3.X-dev`, where `3.X` is your Python version. \n\n## Example code and documentation\n\nBelow is an example showing an unweighted and weighted kernel density.\nFrom the code below, it should be clear how to set the *kernel*, *bandwidth* (variance of the kernel) and *weights*.\nSee the [documentation](https://kdepy.readthedocs.io/en/latest/examples.html) for more examples.\n\n```python\nfrom KDEpy import FFTKDE\nimport matplotlib.pyplot as plt\n\ncustomer_ages = [40, 56, 20, 35, 27, 24, 29, 37, 39, 46]\n\n# Distribution of customers\nx, y = FFTKDE(kernel=\"gaussian\", bw=\"silverman\").fit(customer_ages).evaluate()\nplt.plot(x, y)\n\n# Distribution of customer income (weight each customer by their income)\ncustomer_income = [152, 64, 24, 140, 88, 64, 103, 148, 150, 132]\n\n# The `bw` parameter can be manually set, e.g. `bw=5`\nx, y = FFTKDE(bw=\"silverman\").fit(customer_ages, weights=customer_income).evaluate()\nplt.plot(x, y)\n```\n![Plot](https://raw.githubusercontent.com/tommyod/KDEpy/master/docs/source/_static/img/README_example.png)\n\nThe package consists of three algorithms. Here's a brief explanation:\n- [`NaiveKDE`](https://kdepy.readthedocs.io/en/latest/API.html#naivekde) - A naive computation. Supports d-dimensional data, variable bandwidth, weighted data and many kernel functions. Very slow on large data sets.\n- [`TreeKDE`](https://kdepy.readthedocs.io/en/latest/API.html#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.\n- [`FFTKDE`](https://kdepy.readthedocs.io/en/latest/API.html#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.\n\n## Issues and contributing\n\n### Issues\n\nIf you are having trouble using the package, please let me know by creating an [Issue on GitHub](https://github.com/tommyod/KDEpy/issues) and I'll get back to you.\n\n### Contributing\n\nWhatever your mathematical and Python background is, you are very welcome to contribute to KDEpy.\nTo contribute, fork the project, create a branch and submit and Pull Request.\nPlease follow these guidelines:\n\n- Import as few external dependencies as possible.\n- Use test driven development, have tests and docs for every method.\n- Cite literature and implement recent methods.\n- Unless it's a bottleneck computation, readability trumps speed.\n- Employ object orientation, but resist the temptation to implement many methods -- stick to the basics.\n- Follow PEP8.\n","funding_links":[],"categories":["Jupyter Notebook"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftommyod%2FKDEpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftommyod%2FKDEpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftommyod%2FKDEpy/lists"}