Skip to main content

Recursive Mode Detection for ordinal data

Project description

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!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

remode-0.3.0.tar.gz (194.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

remode-0.3.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file remode-0.3.0.tar.gz.

File metadata

  • Download URL: remode-0.3.0.tar.gz
  • Upload date:
  • Size: 194.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for remode-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1aba78293325c16d38d06c503f86c5974e0de96b5b80809e1e1536b78f1e3c2b
MD5 511b94f478e2ed436a4da638df3c2b76
BLAKE2b-256 0633e0424b8519e968b30181565f2bc231c7497c89295847aa8c0c14bf48136f

See more details on using hashes here.

File details

Details for the file remode-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: remode-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for remode-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ebabf4342c0ddbe6e06f213b48d90a9046edd14a31d5d4ddf1f310de7ef3763a
MD5 0f45ae34993968c689e7c42fbaf32023
BLAKE2b-256 687041ad0c910f1c5806e031bdd8331e99c1f592cf8e979b9e58a40110cbdb5a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page