Skip to content

fix: select_n_components respects xprobe_fraction for prms/cost - #123

Merged
jc-macdonald merged 1 commit into
mainfrom
fix/122-xprobe-fraction-ignored-in-metric-opts
Aug 25, 2026
Merged

fix: select_n_components respects xprobe_fraction for prms/cost#123
jc-macdonald merged 1 commit into
mainfrom
fix/122-xprobe-fraction-ignored-in-metric-opts

Conversation

@jc-macdonald

Copy link
Copy Markdown
Collaborator

Closes #122.

Summary

  • _ensure_metric_opts (used internally by select_n_components to auto-generate a held-out probe set for the prms/cost metrics) only checked whether an explicit xprobe array was supplied -- never the caller's own xprobe_fraction. It always fell back to a hardcoded 10% probe fraction, silently discarding a tuned xprobe_fraction (e.g. from recommend_config()). Affects both "prms" and "cost" equally, since the function doesn't gate on cfg.metric.
  • Fix: resolve the probe fraction from fit_opts["xprobe_fraction"] when it's a positive value, falling back to the historical 10% default only when unset/zero -- same behavior as before for anyone not passing xprobe_fraction.

Test plan

  • Two new unit tests directly on _ensure_metric_opts: respects a configured xprobe_fraction, and falls back to the 10% default when unset.
  • ruff format --preview --check / ruff check --preview -- clean
  • mypy --strict src -- clean
  • pytest -q -m "not perf and not octave" -- 496 passed (0 regressions)

_ensure_metric_opts auto-generates a held-out probe set whenever the
caller hasn't supplied an explicit xprobe array, but it only checked
for that array -- never the caller's own xprobe_fraction -- so it
always fell back to a hardcoded 10% probe fraction regardless of what
was configured (e.g. via recommend_config()). This affected both the
"prms" and "cost" metrics equally, since the function doesn't gate on
cfg.metric at all.

Found while investigating a pp-eigentest trade-study result comparing
cost vs prms for VBPCA-based rank selection (yoavram-lab/pp-eigentest#21).
@jc-macdonald
jc-macdonald merged commit 1ac4093 into main Aug 25, 2026
7 checks passed
@jc-macdonald
jc-macdonald deleted the fix/122-xprobe-fraction-ignored-in-metric-opts branch August 25, 2026 13:47
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.

select_n_components silently ignores xprobe_fraction, always uses a hardcoded 10% probe set

1 participant