BlyxDocumentation
Browse chapters
Documentation / Workflow recipes

Nightingale · Bound a percentile from histogram counts

Bound a percentile from histogram counts without inventing a within-bin value.

Bound a percentile from histogram counts

Histogram counts identify the bucket containing a percentile, not its exact location. Return the interval before deciding whether a threshold was breached. The median is the fourth observation and lies in the 10–30 bucket. A threshold of 20 lies inside that bucket, so the classification stays unresolved.

Run the framework with your own input

Install Blyx 0.2.1 and a Rust toolchain with a host linker, then run the versioned project. Each positional argument is a number or a comma-separated numerical vector. The CLI accepts up to 16 entries per vector. The imported module accepts longer inputs.

git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-nightingale.git
cd blyx-nightingale
blyxc native-run project.blyx -- "2,6" "0,10,30" 0.5 20

API and return values

Returns [lower bound, upper bound, rank, classification]. Classification is -1 when the whole interval is below threshold, 1 when entirely at or above, and 0 when the bins cannot decide. The upper-bound comparison is deliberately conservative. Invalid input returns an empty vector.

ArgumentAccepted input
countsVector of: nonnegative exact integer
edgesVector of: finite number
probabilityprobability in [0,1]
thresholdfinite number

Use the libraries independently

The framework vendors the same library source published in these two repositories. Each module has its own package page, input contract and regression suite.

Try the program

Output Ready
Expected output
10
30
4
0
Open in the full playground →

Practice

Change probability = 0.25. Predict the result, then run the program.

Hint

Returns [lower bound, upper bound, rank, classification]. Classification is -1 when the whole interval is below threshold, 1 when entirely at or above, and 0 when the bins cannot decide. The upper-bound comparison is deliberately conservative.

Worked solution

The result vector is [0, 10, 2, -1]. Compare its fields with the return layout in the API section.

Find

    let probability = 0.5;

Replace with

    let probability = 0.25;

Output after the change

0
10
2
-1