Skip to content

Fix Metadata checks#60

Merged
Marius1311 merged 17 commits intomainfrom
fix/rapids-metadata-check
Jan 16, 2026
Merged

Fix Metadata checks#60
Marius1311 merged 17 commits intomainfrom
fix/rapids-metadata-check

Conversation

@Marius1311
Copy link
Member

This fixes and improves a few things:

  • metadata checks for packages: i had rapids installed but the checking module still failed
  • batched mode for all k-NN backends, so that you can run with many neighbors on memory-limited GPUs
  • some improvements to confusion matrix plotting (filter NaNs better, option to mask, etc. )

- Move _batched_query helper to _knn_backend.py (works with any backend)
- Add batch_size parameter to Kernel.compute_neighbors()
- Simplify _RapidsBackend.query() to single query with cleanup
- All backends now benefit from optional batching for memory management
- Add _make_key() helper that omits underscore when postfix is empty
- Passing prediction_postfix='' now stores result as 'key' instead of 'key_'
- Same behavior for confidence_postfix
BREAKING: prediction_postfix and confidence_postfix now default to '_pred'
and '_conf' respectively. Pass the full postfix including any separator.

- prediction_postfix='_pred' (was 'pred')
- confidence_postfix='_conf' (was 'conf')
- Use '' for no postfix (stores directly as original key)
- Removed _make_key helper - simple concatenation now
Allows filtering cells for confusion matrix via boolean mask:
  cmap.plot_confusion_matrix(label_key='celltype', subset=query.obs['time'] == 'E8.5')
When y_true and y_pred have different categories (e.g., reference has more
time points than query), use union of both category sets as labels.
sklearn interprets float-typed categorical data as continuous. Convert
to strings to ensure proper categorical handling.
…ibility

The pynndescent transformer is non-deterministic without a fixed seed,
causing test failures on CI (Linux) while passing locally (macOS).
Pre-release dependency tests (numba + numpy 2.0) may fail due to
compatibility issues in upstream packages. These failures are expected
and shouldn't block PRs.
sphinx-tabs 3.4.7 is incompatible with docutils 0.22 (KeyError: 'backrefs').
See executablebooks/sphinx-tabs#206
pynndescent uses SIMD instructions that produce different results on
different CPU architectures (macOS ARM vs Linux x86), making exact
matrix comparison impossible. The sklearn test still validates the
core functionality.
@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

❌ Patch coverage is 51.51515% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.38%. Comparing base (a935146) to head (44abfbd).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/cellmapper/model/evaluate.py 9.09% 20 Missing ⚠️
src/cellmapper/model/_knn_backend.py 26.66% 11 Missing ⚠️
src/cellmapper/model/cellmapper.py 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #60      +/-   ##
==========================================
- Coverage   86.98%   85.38%   -1.61%     
==========================================
  Files          13       13              
  Lines        1245     1286      +41     
==========================================
+ Hits         1083     1098      +15     
- Misses        162      188      +26     
Files with missing lines Coverage Δ
src/cellmapper/_docs.py 100.00% <ø> (ø)
src/cellmapper/check.py 100.00% <100.00%> (ø)
src/cellmapper/model/kernel.py 89.05% <100.00%> (ø)
src/cellmapper/model/cellmapper.py 84.10% <92.30%> (+0.25%) ⬆️
src/cellmapper/model/_knn_backend.py 56.14% <26.66%> (-4.47%) ⬇️
src/cellmapper/model/evaluate.py 73.88% <9.09%> (-6.72%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

pynndescent is fundamentally approximate and uses SIMD instructions that
produce different results on different CPU architectures. Instead of
skipping the test entirely, use correlation-based comparison (r > 0.99)
to validate the code path while accommodating minor platform differences.
Add prominent note in Important Notes section that testing must use
'hatch test', not 'uv run pytest'. This ensures the test matrix matches CI.
Linux x86 produces ~0.97 correlation while macOS ARM produces ~0.99.
Use 0.95 threshold to accommodate platform-dependent SIMD differences
while still validating the matrices are structurally similar.
@Marius1311 Marius1311 merged commit e706485 into main Jan 16, 2026
7 of 8 checks passed
@Marius1311 Marius1311 deleted the fix/rapids-metadata-check branch January 16, 2026 13:28
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