Skip to content

Give each per-variable QRF model its own seed - #214

Open
vahid-ahmadi wants to merge 2 commits into
mainfrom
fix/207-qrf-per-variable-seed
Open

vahid-ahmadi wants to merge 2 commits into
mainfrom
fix/207-qrf-per-variable-seed

Conversation

@vahid-ahmadi

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

Copy link
Copy Markdown

Fixes #207.

QRF now derives a distinct random seed for each target during fitting, target-specific subsampling, and numeric and categorical hyperparameter tuning. This removes the shared random quantile stream that coupled stochastic predictions across targets. QRF(seed=...) lets callers control reproducibility.

Child seeds stay within sklearn's supported range even when the base seed is 4294967295. Ordinary seeds retain the per-target values introduced by this PR, None remains supported, and invalid base seeds remain invalid.

The stochastic output changes relative to main, so downstream datasets using joint draws need regeneration and checks of joint-tail statistics. The Markdown examples also pass the repository formatter.

Validation: 12 new seed regressions first produced 6 failures and 6 passing controls, then the affected suite passed all 113 tests.

Final commit: 5a8b81e42236fc6f0d981b91663411a8d58c7e1f. All eight checks passed. Python 3.14 CI passed 367 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.

Every per-variable model builds its own generator from the seed it is
given, and all of them were handed self.seed. They therefore drew the
same random quantiles in the same row order, so variables imputed
together came out rank-comonotonic whatever their dependence in the
donor: three targets with nil conditional dependence reproduced at 0.71
Spearman, 0.11 after this change.

The offset follows the convention already used for the subsampling seed
in _apply_max_train_samples. QRF also now accepts a seed argument; there
was previously no way for a caller to vary the draws.

Fixes #207
@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:37am 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.

Per-variable QRF models share one seed, making jointly imputed variables comonotonic

2 participants