Skip to content

cp_measure 0.4.2

Latest

Choose a tag to compare

@afermg afermg released this 24 Nov 05:41
· 7 commits to main since this release
7a2bef0

cp_measure 0.4.2

Released from 7a2bef0372e28d807ec15eafaa8a784dbff657e0, with production code
unchanged from main 8621a62, including
#177,
#179 and
#180.
The separate NumPy Costes search optimization (#178) and granularity optimization
(#181) are not included.

Less default Costes work

0.4.1 produced extra reverse-fit Costes coefficients; the new default no longer
does so. The featurizer now fits each unordered channel pair once and retains
both coefficients from that fit. This reduces default work for NumPy and
Numba without changing the Costes search algorithm or direct single-pair APIs.

With five channels, the featurizer dispatches ten Costes pairs rather than twenty.
Pearson correlations and both directional slopes, Manders and RWC are unchanged.

Upgrade and compatibility

Although this is a patch release, the default produces fewer output columns.
To retain the extra reverse-fit coefficients:

from cp_measure.featurizer import make_featurizer_config

config = make_featurizer_config(
    channels=["DNA", "ER", "RNA"],
    costes_pair_mode="ordered",
)

The new default is costes_pair_mode="unordered", also when an existing config
omits that key. Pair orientation follows channel-axis order, not alphabetical
order. Reversing channels can change fitted thresholds; reverse-fit coefficients
are not necessarily identical duplicates. Costes scope and precision settings
are unchanged.

Overlap/K fixes

Zero-intensity channels now give NaN for undefined overlap/K coefficients instead
of raising ZeroDivisionError. Sequential overlap normalization in both backends
avoids overflow/underflow from multiplying the two squared sums. Ordinary scores
can change by roundoff; individual products and reductions still follow the
selected precision policy.

Performance evidence and limits

The completed pair-only benchmark and strict audit
compared frozen 0f95d48 against released 0.4.1 on 300 fields. Default NumPy
full-profile throughput improved by 1.35×, and standalone colocalization by
1.86×. All 1,000,716,960 retained native values across the audited
before/after configurations were exactly unchanged, including NaN and
signed-infinity patterns.

Those measurements predate the overlap fixes and are not timings of the final
0.4.2 release tree
. The featurizer implementation is unchanged from the measured
candidate. Each full configuration ran once with eight one-core workers on a
shared host; timing included loading, extraction, assembly and exports, excluding
imports and warmup. Savings come from fewer reverse fits, not identical work
executing faster. Default NumPy remained slower than CellProfiler in that study.
Matched settings still do not imply whole-profile CellProfiler equivalence.

No results from the hypothetical candidate including #178 are attributed to this
release. The original function benchmarks and ordinary correctness tests remain
in CI; the extra featurizer benchmark was removed in #180.