Skip to content

Short-trial preprocessing, lag budgets, compare_networks calibration and speed, auto time budget - #10

Merged
Autoplectic merged 7 commits into
mainfrom
catfr-library-fixes
Oct 26, 2026
Merged

Autoplectic merged 7 commits into
mainfrom
catfr-library-fixes

Conversation

@Autoplectic

Copy link
Copy Markdown
Member

Library fixes found while running infoflow on intracranial EEG (catFR1, OpenNeuro ds004809). The pilot itself is in the stacked PR on catfr-pilot.

Changes

  • Preprocessing on short trials. A candidate whose context leaves no fold with enough held-out windows returned its per-resolution scores in a different shape, and one spanning the whole trial failed on an empty array, so preprocess (and auto.infer) crashed on 80-sample epochs. Both now score 0 and are never chosen.
  • Lag budgets under the network resolution. Adopting the uniform resolution set every node's lag budget to the uniform history (often one sample). Nodes now keep their own budget, at least that history.
  • compare_networks
    • curtail: sequential Monte Carlo p-values (Besag & Clifford 1991). On a 6-edge HFA contrast, curtail=10 with 4 threads took 9 s against 69 s for 500 serial permutations, with the same decisions.
    • map_fn over edges, with seeds drawn up front.
    • A NaN observed difference now gives a NaN p-value instead of the smallest attainable one.
    • Docs and docstring: skeletons selected per condition make the test anti-conservative. Random halves of one condition gave significant differences in 13-15% of splits instead of 5%. One network selected on both conditions pooled restores an exact test.
  • auto.infer time budget. The nonlinear-target check ran outside the budget, and a 3-target pilot can't predict heavy-tailed per-target selection times (47 s to about 1 h on the same data). Checks not started within 50% of the budget are now skipped, and targets not started within 80% select with the plug-in only. Both are recorded as downgrades; nothing changes without a budget. In-flight selections still finish, and preprocessing runs before any budget logic, so this bounds the overrun but isn't a hard stop.

Tests

Regression tests for the short-trial crash and the lag budgets, early stopping and the parallel map, a pooled-selection calibration check, and both budget deadlines. Full suite: 281 passed, 2 skipped (before the deadline commit), plus tests/test_auto.py 15 passed after it.

Made with Cursor

Ryan James and others added 6 commits October 25, 2026 10:19
…er the network resolution

Short trials (e.g. 80-sample epochs) crashed preprocessing: a candidate whose
context window leaves no fold with enough held-out windows returned its
per-resolution scores in a different shape, and one spanning the whole trial
failed on an empty array. Both now score 0, so they are never chosen.

Adopting the uniform network resolution set every node's lag budget to the
uniform history (often one sample); each node now keeps its own budget, at least
that history, so sources acting at longer delays stay candidates.

Co-authored-by: Cursor <cursoragent@cursor.com>
…on guidance

Add curtail (Besag-Clifford sequential Monte Carlo p-values) and map_fn over
edges with seeds drawn up front. A NaN observed difference now gives a NaN
p-value instead of the smallest attainable one. Document that skeletons selected
per condition make the test anti-conservative and show the pooled pattern.

Co-authored-by: Cursor <cursoragent@cursor.com>
…dget

The check ran a Gaussian selection with a local permutation null per nonlinear
target before the pilot, outside the budget (about 1000 s per target on long
broadband epochs). With a budget it now runs in rounds and stops once the rest
would pass half the budget; unchecked targets select with the plug-in only, a
recorded downgrade. The pilot also takes the Gaussian time from the check when no
pilot target used the Gaussian estimator, instead of predicting zero.

Co-authored-by: Cursor <cursoragent@cursor.com>
Per-target selection times are heavy-tailed (one Gaussian selection with a local
null took 47 s and another nearly an hour on the same iEEG data), so neither the
pilot's prediction nor rounds of the nonlinearity check kept runs in budget. Checks
not started within half the budget are now skipped, and auto runs the selection
itself so that targets not started within 80% of it select with the plug-in only;
both are recorded as downgrades. Without a budget nothing changes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Scripts to select, download and epoch catFR1 sessions (OpenNeuro ds004809), run
the within-subject contrast with pooled selection and calibration nulls, a
per-edge null check, and a 25-subject region-level cohort with a between-subject
paired test; report and figures. Epochs use the events' sample column: the BIDS
onset column of this dataset is offset from the recording.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
catFR1 subsequent-memory pilot and 25-subject cohort
@Autoplectic
Autoplectic merged commit 3035281 into main Oct 26, 2026
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.

1 participant