Skip to content

Prune failed Matching trials instead of scoring the training mean - #215

Open
vahid-ahmadi wants to merge 2 commits into
mainfrom
fix/210-matching-silent-mean
Open

vahid-ahmadi wants to merge 2 commits into
mainfrom
fix/210-matching-silent-mean

Conversation

@vahid-ahmadi

@vahid-ahmadi vahid-ahmadi commented Sep 16, 2026

Copy link
Copy Markdown

Fixes #210.

Matching tuning prunes failed donor-matching trials so fallback training means cannot win model selection. A failure in a later chunk invalidates the whole trial. If all trials fail, tuning raises an explicit Matching error.

Chunked predictions retain successful rows and report failed rows as missing values. n_failed_records starts at zero and reflects the latest returned prediction, including small predictions after a previous chunk failure. The Markdown examples also pass the repository formatter.

Validation: eight deterministic backend regressions exercise real Optuna pruning, all-pruned behavior, partial output, index preservation and failure-count resets. They first produced 5 failures and 3 passing controls; the affected suite then passed 61 tests with one optional R module skipped locally. Final real-R CI results are recorded below.

Final commit: 33501b6547945ecb37c4e8e273193f2988491cf2. All eight checks passed. Python 3.14 CI passed 361 tests with 2 skipped, including all 13 real R/StatMatch Matching tests; the pipeline example passed. Python 3.12 smoke tests, documentation, lint, changelog and deployment checks also passed. The two skipped modules require optional MDN dependencies. Coverage XML was generated; the existing Codecov upload step reported its nonblocking protected-branch token error.

The exact final heads of #214, #215, #216 and #217 also merge cleanly together. Their combined suite passed 350 tests with 3 optional skips, and the combined source distribution, wheel, import and numerical smoke checks passed. Merge these before #219, then rebase #219 while retaining its broader correctness fixes.

Both tuning handlers caught every exception and substituted the training
mean, with no log and no counter, and that score went straight into the
Optuna objective. A mean-predictor is not a neutral score - on a
low-signal target it can beat a genuine matching fit on quantile loss -
so a parameter set under which matching always failed could be selected
as best and reported as the winning method.

Both now log the exception and raise TrialPruned. The predict path keeps
its NaN fill, which is the right behaviour there, but now reports the
total number of unmatched records rather than leaving silent NaN blocks.

Fixes #210
@vercel

vercel Bot commented Sep 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
microimpute-dashboard Ready Ready Preview Sep 17, 2026 10:35am UTC

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.

Matching silently substitutes the training mean on failure, and that score is fed to Optuna

2 participants