Repository navigation
FIX keep CrossSubject results subject-specific for grouped folds - #1211
Conversation
|
Exact-head validation is green on |
|
Updated exact-head validation: on |
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
bruAristimunha
left a comment
There was a problem hiding this comment.
Thanks @lindicaphxag-tech. The provenance invariant for grouped CrossSubject folds is the right one, and the design keeps one fit per fold while scoring/storing per held-out subject, consistent with #1210. The default LeaveOneGroupOut path is equivalent because every fold still holds one subject, so score_subjects=[subject] collapses to the pre-PR grouping. CI is green on 92897f6.
One ask before I approve: the description commits to preserving partial-cache work plans — could you add a focused test that pre-fills the result cache for one of the held-out subjects of a fold and asserts the fold is still fit once and only the uncached subject gets a new row? That makes the contract load-bearing.
Merge-order note for the series: #1206 → #1210 → #1207 → #1211 minimises hand-merging; this one touches _evaluate_fold and _build_task_list and should land last, so expect a rebase once the others are in.
|
Addressed on current head |
|
@lindicaphxag-tech #1206, #1207 and #1210 are now on develop, so this one has a real conflict in |
4ddc7e6 to
3d4f28d
Compare
|
Rebased the PR onto current |
|
Thanks for the rebase, @lindicaphxag-tech. I merged current develop into your branch: |
|
The only remaining CI failure is Docs, and its traceback is unrelated to this PR: |
Summary
CrossSubjectEvaluationsupports grouped cross-validation strategies where a single test fold can contain more than one subject (for exampleGroupKFold(n_splits < n_subjects)). The flattened evaluation engine currently assigns the entire fold totest_meta["subject"].iloc[0]and then only splits scores by session.That silently mixes different held-out subjects that share a session label and stores the results under whichever subject appears first.
Context in the evaluation-safety series
This is the CrossSubject follow-up to #1207 and #1210. #1207 enables explicit grouped splitters; #1210 preserves session identity for multi-session folds; this PR completes the same result-provenance invariant across subjects so grouped CrossSubject folds cannot silently attribute several held-out subjects to the first one.
Fix
Keep one fit per CV fold, but score and store the fitted model separately for every held-out subject/session that still needs this pipeline.
CrossSubjectEvaluation;save_model=True, store the one fitted fold model under every held-out subject that owns a result;Regression coverage
A focused test uses four subjects, two sessions, and
n_splits=2, so everyGroupKFoldtest fold holds out two subjects simultaneously. It verifies:n_samples_testmatches the true trial count of each subject/session pair.This is the CrossSubject analogue of the same provenance invariant addressed for multi-session CrossSession folds in #1210.