pub fn isotonic_regression(
y: &[f64],
weights: Option<&[f64]>,
increasing: bool,
) -> Result<IsotonicResult, ErrorsJSL>Expand description
The weighted least-squares fit of y by a non-decreasing (or, with increasing = false,
non-increasing) sequence, min Σ wᵢ (xᵢ − yᵢ)² subject to x₁ ≤ x₂ ≤ … ≤ xₙ (SciPy’s
isotonic_regression). The pool-adjacent-violators algorithm merges each new observation
with the blocks before it while their weighted means are out of order; every block’s value
is its weighted mean, in O(n) time. weights default to one and must be positive.