Skip to content

A14-07: expected_mi() silently returns exactly 0 for N ≳ 1100 due to double underflow (breaks normalize=TRUE chance-correction) #91

Description

@ms609

src/expected_mi.cpp:85-88Pk = pow(2, log2P) at kmin underflows to 0 in double precision for large balanced partitions (P(K=0) ≈ 2^-1197 at N=1200), and if (Pk > 0.0) combined with the multiplicative recurrence means it never recovers for the rest of the sum.

Reproduced by the opus verifier: balanced expected_mi(c(N/2,N/2), c(N/2,N/2)) gives 1.45e-3 at N=500, 7.22e-4 at N=1000, then exactly 0 at N=1100/1200/2000.

Consequence: ClusteringConcordance(normalize = TRUE) on a >1000-taxon tree reports uncorrected mutual information while claiming chance-correction, silently changing what the statistic measures at exactly the scale (large modern phylogenomic matrices) where the correction matters most.

Fix: work in log space throughout (avoid materializing Pk as a linear-scale double), or start the recurrence at the distribution's mode rather than kmin.

Filed by /red-team area 14 (opus finder, 2026-08-05), confirmed by opus verifier with live repro.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:14Red-team focus area 14in-progressBeing fixed; claiming comment names the branchred-teamFiled by the /red-team rotationsev:medP2: wrong on edge input / search quality

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions