Metadata-Version: 2.4
Name: pydpc
Version: 0.2.1
Summary: Clustering by fast search and find of density peaks
Author-email: Christoph Wehmeyer <wehmeyer.chris@gmail.com>
License-Expression: LGPL-3.0-or-later
Project-URL: Homepage, https://github.com/cwehmeyer/pydpc
Project-URL: Repository, https://github.com/cwehmeyer/pydpc.git
Project-URL: Issues, https://github.com/cwehmeyer/pydpc/issues
Keywords: clustering,density-peaks,unsupervised-learning,machine-learning,cython
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=2
Requires-Dist: matplotlib
Dynamic: license-file

# pydpc - a Python package for Density Peak-based Clustering

![CI](https://github.com/cwehmeyer/pydpc/actions/workflows/ci.yml/badge.svg)
[![codecov](https://codecov.io/gh/cwehmeyer/pydpc/branch/master/graph/badge.svg)](https://codecov.io/gh/cwehmeyer/pydpc)
[![CodeQL](https://github.com/cwehmeyer/pydpc/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/cwehmeyer/pydpc/actions/workflows/github-code-scanning/codeql)
[![Docs](https://github.com/cwehmeyer/pydpc/actions/workflows/docs.yml/badge.svg)](https://cwehmeyer.github.io/pydpc/)
[![PyPI version](https://badge.fury.io/py/pydpc.svg)](https://pypi.python.org/pypi/pydpc)
[![PyPI downloads](https://img.shields.io/pypi/dm/pydpc.svg)](https://pypi.python.org/pypi/pydpc)

*Clustering by fast search and find of density peaks* was designed by Alex Rodriguez and Alessandro Laio; see their [project page](http://people.sissa.it/~laio/Research/Res_clustering.php) for more information.

The pydpc package aims to make this algorithm available for Python users.

### Installation

Install pydpc via pip from the Python package index

```bash
pip install pydpc
```

or the latest version from github

```bash
pip install git+https://github.com/cwehmeyer/pydpc.git@master
```

### Quick start

```python
import numpy as np
from pydpc import Cluster

# a simple bimodal data set: two gaussian blobs centered at x=-4 and x=+4
npoints = 1000
points = np.random.randn(npoints, 2)
points[:, 0] += 4 * np.random.choice([-1, 1], size=npoints)

# computes distances, density, and delta, then shows the decision graph
clu = Cluster(points)

# pick outliers in the decision graph as cluster centers and assign points
clu.assign(min_density=25, min_delta=6)

clu.membership   # cluster index for each point
clu.core_idx     # indices of high-confidence ("core") points
clu.halo_idx     # indices of low-confidence ("halo") points
```

See [`docs/examples/Example01.ipynb`](docs/examples/Example01.ipynb) for a full walkthrough with plots.

See [`CHANGELOG.md`](CHANGELOG.md) for release history.
