Skip to main content

Code style: black Imports: isort codecov GitHub Workflow Status GitHub Workflow Status GitHub Workflow Status

DADApy is a Python package for the characterization of manifolds in high-dimensional spaces.

Homepage

For more details and tutorials, visit the homepage at: https://dadapy.readthedocs.io/

Quick Example

import numpy as np
from dadapy.data import Data

# Generate a simple 3D gaussian dataset
X = np.random.normal(0, 1, (1000, 3))

# initialize the "Data" class with the set of coordinates
data = Data(X)

# compute distances up to the 100th nearest neighbor
data.compute_distances(maxk=100)

# compute the intrinsic dimension using 2nn estimator
id, id_error, id_distance = data.compute_id_2NN()

# compute the intrinsic dimension up to the 64th nearest neighbors using Gride
id_list, id_error_list, id_distance_list = data.return_id_scaling_gride(range_max=64)

# compute the density using PAk, a point adaptive kNN estimator
log_den, log_den_error = data.compute_density_PAk()

# find the peaks of the density profile through the ADP algorithm
cluster_assignment = data.compute_clustering_ADP()

# compute the neighborhood overlap with another dataset
X2 = np.random.normal(0, 1, (1000, 5))
overlap_x2 = data.return_data_overlap(X2)

# compute the neighborhood overlap with a set of labels
labels = np.repeat(np.arange(10), 100)
overlap_labels = data.return_label_overlap(labels)

Currently implemented algorithms

  • Intrinsic dimension estimators

  • Two-NN estimator

    Facco et al., Scientific Reports (2017)

  • Gride estimator

    Denti et al., Scientific Reports (2022)

  • I3D estimator (for both continuous and discrete spaces)

    Macocco et al., Physical Review Letters (2023)

  • BID estimator

    Acevedo et al., Nature Communications Physics (2025)

  • Density estimators

  • kNN estimator

  • k*NN estimator (kNN with an adaptive choice of k)

  • PAk estimator

    Rodriguez et al., JCTC (2018)

  • point-adaptive mean-shift gradient estimator

    Carli et al., ArXiv (2024)

  • BMTI estimator

    Carli et al., ArXiv (2024)

  • Density peaks clustering methods

  • Density peaks clustering

    Rodriguez and Laio, Science (2014)

  • Advanced density peaks clustering

    d’Errico et al., Information Sciences (2021)

  • k-peak clustering

    Sormani, Rodriguez and Laio, JCTC (2020)

  • Manifold comparison tools

  • Neighbourhood overlap

    Doimo et al., NeurIPS (2020)

  • Information imbalance

    Glielmo et al., PNAS Nexus (2022)

  • Feature selection and weighting tool

  • Differentiable Information Imbalance

    Wild et al., Nature Communications (2025)

  • Causal analysis tools

  • Imbalance Gain

    Del Tatto et al., PNAS (2024)

  • Community causal graph

    Allione et al., arXiv (2025)

Installation

The package is compatible with the Python versions 3.8, 3.9, 3.10, 3.11, and 3.12. The methods of the classes DiffImbalance and CausalGraph are only compatible with Python>=3.9. We currently only support Unix-based systems, including Linux and macOS. For Windows machines, we suggest using the Windows Subsystem for Linux (WSL).

The package requires numpy, scipy, scikit-learn, jax, jaxlib and matplotlib for the visualizations.

The package contains Cython-generated C extensions that are automatically compiled during installation.

The latest release is available through pip:

pip install dadapy

To install the latest development version, clone the source code from GitHub and install it with pip as follows:

pip install git+https://github.com/sissa-data-science/DADApy

Alternatively, if you'd like to modify the implementation of some function locally you can download the repository and install the package with:

git clone https://github.com/sissa-data-science/DADApy.git
cd DADApy
python setup.py build_ext --inplace
pip install .

The methods of the classes DiffImbalance and CausalGraph can be run on GPU, using a suitable installation of JAX on a GPU platform. The code has been tested using JAX v0.4.30 with CUDA 12, which can be installed with:

pip install --upgrade "jax[cuda12_pip]==0.4.30" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html

For more information on the installation of the JAX library on GPUs see the official repository.

Citing DADApy

A description of the package is available here.

Please consider citing it if you found this package useful for your research:

@article{dadapy,
    title = {DADApy: Distance-based analysis of data-manifolds in Python},
    journal = {Patterns},
    pages = {100589},
    year = {2022},
    issn = {2666-3899},
    doi = {https://doi.org/10.1016/j.patter.2022.100589},
    url = {https://www.sciencedirect.com/science/article/pii/S2666389922002070},
    author = {Aldo Glielmo and Iuri Macocco and Diego Doimo and Matteo Carli and Claudio Zeni and Romina Wild and Maria d’Errico and Alex Rodriguez and Alessandro Laio},
    }

Metadata

Release files for dadapy 0.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dadapy 0.3.4
File Size Uploaded
dadapy-0.3.4.tar.gz 1.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for dadapy 0.3.4
File Interpreter ABI Platform
dadapy-0.3.4-cp312-cp312-macosx_12_0_arm64.whl CPython 3.12 CPython 3.12 macOS 12.0+ ARM64 Details

Total release size: 3.2 MB

Release files / dadapy-0.3.4.tar.gz

Download URL dadapy-0.3.4.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
6907f08b4323de86d84ca985c9c403efd49ae9b5ab2da37315d975b68634244b
BLAKE2b-256 checksum
How to use checksums
2aafba5c755a86acf8aca641bbedfbbabaf52c8c3f12250ae80c6475f9831146
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / dadapy-0.3.4-cp312-cp312-macosx_12_0_arm64.whl

Download URL dadapy-0.3.4-cp312-cp312-macosx_12_0_arm64.whl
Size 1.9 MB
Tags CPython 3.12 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
cf7e7a5caa087a7e2c084be2f79878d87e329d8760055c41f880cfa11d9c9f51
BLAKE2b-256 checksum
How to use checksums
0ab2104bb652d25cbfc00bf3b9f79734b2318eadefcb7997849e63eb0a3b7a56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.3.4 This release

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page