Skip to content

test(intensity-histogram): vet the 21 untested IBSI IH dispersion/index features#367

Open
sameeul wants to merge 1 commit into
PolusAI:mainfrom
sameeul:test/vet-intensity-histogram-oracle
Open

test(intensity-histogram): vet the 21 untested IBSI IH dispersion/index features#367
sameeul wants to merge 1 commit into
PolusAI:mainfrom
sameeul:test/vet-intensity-histogram-oracle

Conversation

@sameeul

@sameeul sameeul commented Jul 11, 2026

Copy link
Copy Markdown
Member

What

Adds test_ih_dispersion_and_index_values — value-check coverage for the 21 IBSI
Intensity-Histogram (IH) features that previously had no assertion at all
:

  • 7 "…Value" dispersion features: mean-absolute-deviation, robust-MAD, median-AD,
    interquantile range, coefficient of variation, quantile coefficient of dispersion, robust mean.
  • 14 "…Index" variants: variance / skewness / excess-kurtosis / interquantile-range /
    range / MAD / robust-MAD / median-AD / CoV / QCoD / entropy / uniformity / robust-mean, over
    the 1-based bin-index domain.

Test-only — no production code changes.

Why

A test-suite vetting audit found that test_ih_integer_domain_values covered 26 of the 47
IH features, but these 21 dispersion / index features were never checked. A regression in any
of them (or in the robust-window trimming) would have gone undetected.

How the ground truth is trustworthy

Ground truth is derived independently from the IBSI first-order definitions applied to the
discretised N-bin histogram — it is not copied from intensity_histogram.cpp. So a formula
regression fails the test rather than being silently pinned. For the "…Value" dispersion
features this is an oracle-grade check against the IBSI intensity-histogram definitions; the
"…Index" variants are the same statistics over the bin-index domain (Nyxus-specific) and are
pinned analytically.

Two ROIs are used so the robust window is exercised both degenerately and non-trivially:

ROI pixels N freq robust window [p10Idx, p90Idx]
1 (existing 5-px fixture) {1,1,3,5,7} 3 {2,1,2} covers all bins → robust == full
2 (new 17-px fixture) {0, 10×5, 20×6, 30×4, 40} 5 {1,5,6,4,1} trims both tail bins → robust ≠ full

ROI-2 is specifically constructed so robustMean/robust-MAD differ from their full-range
counterparts, giving the trimming path real coverage.

Verification

Ubuntu C++ GoogleTest CI is green:

[ RUN      ] TEST_NYXUS.TEST_IH_DISPERSION_AND_INDEX_VALUES
[       OK ] TEST_NYXUS.TEST_IH_DISPERSION_AND_INDEX_VALUES (0 ms)
...
[  PASSED  ] 696 tests.

The pass confirms nyxus's IH dispersion/index implementation agrees with the independently
derived IBSI definitions.

🤖 Generated with Claude Code

…atures

The IBSI Intensity-Histogram family had 26 of its 47 features value-checked by
test_ih_integer_domain_values; the remaining 21 (7 "...Value" dispersion features
and 14 "...Index" variants) had no assertion at all — a coverage gap surfaced by
the test-suite vetting audit.

Add test_ih_dispersion_and_index_values covering all 21:
  * MAD, robust-MAD, median-AD, interquantile range, coefficient of variation,
    quantile coefficient of dispersion, robust mean ("...Value"), plus the
    variance/skewness/kurtosis/range/entropy/uniformity/... "...Index" variants.
  * Ground truth is derived independently from the IBSI first-order definitions
    applied to the discretised N-bin histogram (not copied from the C++), so a
    formula regression is caught rather than pinned.
  * Two ROIs: the existing 5-px fixture (N=3, robust window covers all bins) and a
    new 17-px fixture (N=5) whose [p10Index,p90Index] window strictly trims the two
    tail bins, so the robust-mean / robust-MAD trimming path is genuinely exercised
    (robust != full).

No production code changes — test-only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant