Skip to main content

Crate segindex

Crate segindex 

Source
Expand description

Rank-Order Information Theory Segregation Index (H^R) for continuous variables.

Rust port of the Python package segindex. Both implementations follow Reardon (2011) and Reardon & Bischoff (2011, Appendix A) and produce identical results (within floating-point tolerance).

let area1 = vec![
    vec![80.0, 80.0, 70.0, 70.0],
    vec![50.0, 45.0, 40.0],
    vec![20.0, 20.0, 20.0, 10.0],
];
let h_r = segindex::estimate_hp(&area1, None, 14, 4);
assert!((h_r - 0.7181836873727949).abs() < 1e-8);

Structs§

HpDetails
Intermediate results of the estimation, useful for plotting.

Functions§

delta_m
Coefficient d_m = 2 * integral of p^m * E(p) dp over [0, 1].
entropy_p
Binary entropy E(p) in bits; p is nudged away from exact 0/1 by 1e-6.
estimate_hp
Estimate the rank-order information theory segregation index H^R.
estimate_hp_details
Like estimate_hp but also returns the H(p) curve and the fitted polynomial coefficients.
rank_transform
Rank-order transformation: pool all values and map each observation to its (weighted) percentile in (0, 1]. Returns one vector per sector.
theil_p
Theil information theory index H for a binary split.