Skip to content

fix: warn when recommend_config extrapolates beyond validated p/n range - #117

Merged
jc-macdonald merged 1 commit into
mainfrom
fix/116-recommend-config-scale-warning
Aug 20, 2026
Merged

fix: warn when recommend_config extrapolates beyond validated p/n range#117
jc-macdonald merged 1 commit into
mainfrom
fix/116-recommend-config-scale-warning

Conversation

@jc-macdonald

Copy link
Copy Markdown
Collaborator

Summary

Fixes #116. recommend_config(n, p) buckets purely on p (smallp <=30, trans <=70, large >70), with no upper bound and no use of n at all -- p>70 always maps to the identical "large" bucket config no matter how large p gets or how small n is.

Why this matters

Found while extending pp-eigentest's trade study to genomics-representative data shapes (small cohort, thousands of features -- p/n of 50-1000x, common for bulk RNA-seq/microarray data). The Option A trade study's own regime grid (analysis/trade_study) only covers p up to 200 and p/n up to 2.0 -- computed directly from every TRAINING_REGIMES/VALIDATION_REGIMES entry. Anything past that is silently extrapolated.

Empirically this breaks down: recommend_config(n=30, p=2000) returns the identical config as recommend_config(n=100, p=100), but recovers rank 9 instead of the true rank 5 (vs. correct recovery at the balanced shape).

Change

recommend_config now warns (UserWarning) when p > 200 or p/n > 2.0, mirroring the existing missingness != "auto" warning from #110. This doesn't fix the underlying gap -- that needs the Option A trade study extended with an aspect-ratio axis and re-run, a bigger effort tracked in #116 for later -- but callers are no longer silently hunted an untested extrapolation.

Test plan

  • just ci (format, lint, mypy --strict, pytest --cov) passes, defaults.py at 100% coverage
  • New tests: warns past p=200, warns past p/n=2.0 even when p itself is small, silent within the validated region (boundary values p=200/p/n=2.0 inclusive)

🤖 Generated with Claude Code

…ge (#116)

recommend_config buckets solely on p, with no upper bound and no use of
n at all -- p>70 always maps to the same "large" bucket config
regardless of how large p gets or how small n is. The Option A trade
study's regime grid only covers p up to 200 and p/n up to 2.0; anything
past that is an untested extrapolation. Empirically this breaks down at
genomics-scale aspect ratios (small cohort, thousands of features):
n=30,p=2000 recovers rank 9 instead of the true rank 5 using the same
config as a balanced 100x100 matrix.

Warns (UserWarning) when p or p/n falls outside the validated region,
mirroring the existing missingness warning from #110. Doesn't fix the
underlying gap -- that needs the Option A trade study extended with an
aspect-ratio axis and re-run, tracked in #116 -- but callers are no
longer silently handed an untested config.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@jc-macdonald
jc-macdonald merged commit f2e566f into main Aug 20, 2026
7 checks passed
@jc-macdonald
jc-macdonald deleted the fix/116-recommend-config-scale-warning branch August 20, 2026 16:09
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.

recommend_config buckets by p alone -- ignores n and never differentiates beyond p=70, breaking down at genomics-scale aspect ratios

1 participant