Skip to main content

ReMoDe: a Python library for efficient mode detection in ordinal data distributions.

Docs DOI CI PyPI Python versions

ReMoDe (Recursive Mode Detection) is a Python library designed for robust mode detection in ordinal data distributions. By default it uses a bootstrap significance test (with binomial and Fisher alternatives) to determine whether a candidate maximum is a true local mode.

Are you an R user? Please find the R version here: https://cran.r-project.org/web/packages/remode/index.html

Features

  • Mode Detection: Identifies all potential local maxima in the dataset.
  • Statistical Tests: Implements bootstrap (default), Fisher's exact, and binomial tests to validate modes.
  • Mode Statistics: Returns per-mode p-values and approximate Bayes factors.
  • Modality Definition: Supports shape_based (default) and peak_based definitions.
  • Data Formatting: Converts raw data into histogram format for analysis.
  • Stability Analysis: Includes functionality to assess the stability of detected modes using jackknife resampling.
  • Visualization: Provides methods to plot the histogram of data along with identified modes.

Installation

pip install remode

Usage

Here is a simple example of how to use the ReMode library:

from remode import ReMoDe

# Sample data (histogram counts)
xt_count = [8, 20, 5, 2, 6, 2, 30]

# Create an instance of ReMoDe
detector = ReMoDe()  # defaults: bootstrap test, descriptive_peaks correction, shape_based definition

# Fit model
results = detector.fit(xt_count)
# results contains:
# - nr_of_modes
# - modes
# - p_values
# - approx_bayes_factors

# Plot the results
detector.plot_maxima()

# Perform stability analysis
stability_info = detector.remode_stability(percentage_steps=50)

See also the tutorial here.

Citation

Please cite the following paper:

Hoffstadt, M., Waldorp, L., Garcia‐Bernardo, J., & van der Maas, H. (2026). ReMoDe–Recursive modality detection in distributions of ordinal data. British Journal of Mathematical and Statistical Psychology.

and the following software

Garcia-Bernardo, J., Hoffstadt, M., Waldorp, L., & van der Maas, H. L. J. (2026). ReMoDe: a Python library for efficient mode detection in ordinal data distributions. Zenodo. https://doi.org/10.5281/zenodo.18743126

Contributing

Contributions are what make the open source community an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

Please refer to the CONTRIBUTING file for more information on issues and pull requests.

License

This project is licensed under the GNU GPLv3. This allows you to do almost anything they want with this project, except distributing closed source versions.

Contact

This project is a port of the R version of ReMoDe. It is maintained by the ODISSEI Social Data Science (SoDa) team.

SoDa logo

Do you have questions, suggestions, or remarks? File an issue in the issue tracker!

Metadata

Release files for ReMoDe 0.3.0

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

Source distribution (sdist)

Source distribution for ReMoDe 0.3.0
File Size Uploaded
remode-0.3.0.tar.gz 194.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ReMoDe 0.3.0
File Interpreter ABI Platform
remode-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 205.9 kB

Release files / remode-0.3.0.tar.gz

Download URL remode-0.3.0.tar.gz
Size 194.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1aba78293325c16d38d06c503f86c5974e0de96b5b80809e1e1536b78f1e3c2b
BLAKE2b-256 checksum
How to use checksums
0633e0424b8519e968b30181565f2bc231c7497c89295847aa8c0c14bf48136f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / remode-0.3.0-py3-none-any.whl

Download URL remode-0.3.0-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ebabf4342c0ddbe6e06f213b48d90a9046edd14a31d5d4ddf1f310de7ef3763a
BLAKE2b-256 checksum
How to use checksums
687041ad0c910f1c5806e031bdd8331e99c1f592cf8e979b9e58a40110cbdb5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.1

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