value to evaluate CDF
slice containing the probability associated with the Categorical Distribution
import mir.ndslice.slice: sliced; import mir.test: shouldApprox; static immutable x = [0.1, 0.5, 0.4]; auto p = x.sliced; 0.categoricalCDF(p).shouldApprox == 0.1; 1.categoricalCDF(p).shouldApprox == 0.6; 2.categoricalCDF(p).shouldApprox == 1.0;
Can also use dynamic array
import mir.test: shouldApprox; double[] p = [0.1, 0.5, 0.4]; 0.categoricalCDF(p).shouldApprox == 0.1; 1.categoricalCDF(p).shouldApprox == 0.6; 2.categoricalCDF(p).shouldApprox == 1.0;
Computes the Categorical cumulative distribution function (CDF).