Skip to main content

No project description provided

Project description

Check bimodality of a distribution using van_der_eijk function.

Return the A score ref https://www.researchgate.net/publication/225958476_Measuring_Agreement_in_Ordered_Rating_Scales

Limiations

  1. The first half of the histogram should not not be way too heavy (>2x) or way too light (<0.5x) of the second half of the histogram.

Usage

This crate provides two functions

  • van_der_eijk return A score. If it is less than 0, the distribution is bi-modal.
  • is_bimodal which is QoL wrapper on van_der_eijk function.
assert!(van_der_eijk(&[30, 40, 210, 130, 530, 50, 10]) > 0.0);
assert!(van_der_eijk(&[30, 40, 210, 10, 530, 50, 10]) > 0.0);
assert!(van_der_eijk(&[30, 40, 10, 10, 30, 50, 100]) > 0.0);
assert!(van_der_eijk(&[3, 4, 1, 1, 3, 5, 10]) > 0.0);
assert!(van_der_eijk(&[3, 4, 1, 1, 3, 5, 1]) > 0.0);
assert!(van_der_eijk(&[1, 1, 1, 1, 1, 1, 1]) > 0.0);
assert!(van_der_eijk(&[1, 1, 1, 1, 1, 1, 1000]) > 0.0);

// bimodal and detected as bimodal.
assert!(van_der_eijk(&[10000, 1, 1, 1, 1, 1, 10]) < 0.0);
assert!(van_der_eijk(&[10, 10, 0, 0, 0, 10, 10]) < 0.0);
assert!(van_der_eijk(&[10, 10, 0, 0, 0, 0, 10]) < 0.0);
assert!(van_der_eijk(&[1, 1, 1, 0, 0, 1, 1]) < 0.0);
assert!(van_der_eijk(&[1, 1, 1, 0, 1, 1, 1]) < 0.0);

// Test cases that bring the limitations of the algorithm.
// This should be bi-modal. Algo fails because weights are not balanced here.
// One side of the see-saw is 2x heavier.
assert!(van_der_eijk(&[10, 11, 0, 0, 0, 0, 3, 3]) > 0.0);
assert!(van_der_eijk(&[10, 11, 0, 0, 0, 0, 30, 31]) > 0.0);
assert!(van_der_eijk(&[10, 11, 0, 0, 0, 0, 20, 11]) < 0.0);

TODO

  • python bindings

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

is_bimodal-0.1.0-cp312-none-win_amd64.whl (180.1 kB view details)

Uploaded CPython 3.12 Windows x86-64

File details

Details for the file is_bimodal-0.1.0-cp312-none-win_amd64.whl.

File metadata

File hashes

Hashes for is_bimodal-0.1.0-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 ed2077eafc9e65d8e50a04b00f7d88e67e84bf92b30278620a0ce5e47a5abadd
MD5 097e23978255f35a8d60a826ce7c8ff4
BLAKE2b-256 8fc9af383386a43a5336cc538c6265a5b9834d3a19a2fe0d1d8ef0be08daff10

See more details on using hashes here.

Supported by

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