This document translates the commitments in review_response.md into a concrete analysis plan for brain-decoder.
The reviewer response implies three kinds of work:
- Reproduce and harden the existing decoding pipeline so the current HCP, IBC, and ROI analyses can be rerun reliably.
- Add missing analyses that were explicitly promised in the response letter.
- Package the outputs into figures, tables, and supplementary artifacts that map cleanly onto manuscript revisions.
After each task in this plan is completed, write a short reflection before moving on to the next task. Each reflection should include:
- What worked.
- What did not work or remained ambiguous.
- The next checks or follow-up analyses still needed to fully answer the reviewer's question tied to that task.
Treat these reflections as part of the deliverable for each task, not as optional notes.
The repository already contains partial scaffolding for several decoding analyses:
jobs/decoding_hcp_nv.pyfor HCP group-map decoding.jobs/decoding_eval.pyfor aggregate HCP evaluation.jobs/decoding_ibc.pyfor IBC decoding.jobs/decoding_seeds.pyfor ROI decoding.braindec/predict.pyfor task/concept/domain decoding.braindec/cogatlas.pyfor ontology construction and task/concept/domain mappings.
There are also important gaps that should be treated as prerequisites:
jobs/decoding_cnp.pyis referenced inreview_response.mdbut does not exist in the repo.jobs/decoding_ibc.pyandjobs/decoding_seeds.pyappear stale relative to the currentimage_to_labels_hierarchicalAPI.- Multiple job scripts hard-code
project_diranddevice, which will block reproducible reruns. - There is no script yet for per-term analysis, null/permutation baselines, embedding geometry, or SNR/sample-size sweeps.
- Stabilize the decoding jobs and evaluation interfaces.
- Rerun and document the current HCP benchmark.
- Add cross-dataset decoding for IBC and CNP.
- Add term-level, ontology, and chance-normalized analyses.
- Add embedding-geometry and SNR analyses.
- Add the targeted emotion and striatum follow-up analyses.
- Optionally run an NSD pilot if data are available and time permits.
Make the current decoding and evaluation scripts runnable, configurable, and consistent with the current braindec APIs.
- Changing model architecture.
- Re-training the CLIP model.
- Refactoring the whole repository.
- Update
jobs/decoding_hcp_nv.py,jobs/decoding_ibc.py,jobs/decoding_seeds.py, andjobs/decoding_eval.pyto accept CLI arguments forproject_dir,data_dir,results_dir,device,section,model_id, andreduced. - Fix stale calls to
image_to_labels_hierarchicalso all jobs pass aCognitiveAtlasobject rather than raw arrays. - Remove hard-coded
mpsdevice usage and default to a CLI/device helper. - Standardize output directory layout across HCP, IBC, CNP, ROI, and future analyses.
- Verify that ground-truth files are loaded from the correct dataset-specific locations.
- Add a small README section or module docstring describing expected inputs and outputs for each analysis job.
- Runnable decoding jobs.
- Consistent prediction CSV outputs.
- A stable base for all downstream analyses.
Reproduce the core HCP group-map decoding results and explicitly document the task-level mapping used in the manuscript.
- Expanding the benchmark beyond the currently selected representative task-domain contrasts.
- Fairness comparison with external IBMA models on HCP.
- Confirm the seven representative HCP contrasts used for task-level evaluation:
- Emotion: Faces vs Shapes
- Gambling: Reward vs Baseline
- Language: Story vs Math
- Motor: Average
- Relational: Relational vs Match
- Social: TOM vs Random
- Working Memory: 2-Back vs 0-Back
- Encode this mapping in a dedicated metadata file rather than leaving it implicit in filenames.
- Rerun
jobs/decoding_hcp_nv.pyafter pipeline hardening. - Update
jobs/decoding_eval.pyso it reads the explicit mapping file and computes task, concept, and domain metrics deterministically. - Export a supplementary table containing:
- HCP image id
- selected contrast
- mapped task
- mapped concepts
- mapped domain
- top-k decoded predictions
- Reproducible HCP benchmark outputs.
- Supplementary mapping table for task-to-concept/domain interpretation.
Show that NiCLIP generalizes beyond HCP by decoding IBC statistical maps.
- Full IBC methodological harmonization.
- Training on IBC.
- Repair and parameterize
jobs/decoding_ibc.py. - Create an explicit IBC ground-truth mapping file from image names to task, concept, and domain labels.
- Reuse the same evaluation interface as HCP so metrics are comparable.
- Produce aggregate metrics:
- task Recall@4
- concept Recall@4
- domain Recall@2
- Break out results by task family where possible, especially emotion-related tasks if present.
- Export per-image prediction tables for supplement use.
- IBC prediction outputs.
- IBC summary metrics.
- Cross-dataset comparison against HCP.
Add the missing CNP benchmark promised in the response letter.
- Broad psychiatric interpretation beyond task decoding.
- Subject-level clinical modeling.
- Add a new
jobs/decoding_cnp.pymodeled after the HCP and IBC jobs. - Define a CNP ground-truth mapping file for tasks such as BART, PAM encoding/retrieval, SCAP, Stop Signal, and Task Switching.
- Ensure the CNP job writes outputs into a dataset-specific predictions directory with the same CSV schema used elsewhere.
- Add or extend an evaluation script to score CNP task/concept/domain Recall@K.
- Summarize which CNP tasks transfer well and which do not.
- New CNP decoding job.
- CNP evaluation outputs.
- Cross-dataset generalization section inputs.
Test whether NiCLIP can decode more specific emotional states than the coarse HCP emotion contrast.
- Open-ended text generation of emotions.
- Claiming fine-grained emotion decoding if ontology coverage is weak.
- Identify emotion-specific contrasts in IBC and/or CNP that are more granular than
Faces vs Shapes. - Audit the current Cognitive Atlas task and concept vocabulary for emotion-specific labels such as fear, anger, disgust, and happiness.
- If needed, extend the vocabulary-generation path so emotion concepts and task definitions are included in the decoding vocabulary.
- Generate vocabulary embeddings and priors for the expanded emotion-related vocabulary.
- Decode the selected emotion maps and compare:
- coarse emotion-domain predictions
- emotion-concept predictions
- fine-grained task predictions
- Report whether failures are due to ontology coverage, training-data sparsity, or embedding mismatch.
- Emotion-specific decoding results.
- A clear statement of current granularity limits.
Quantify which individual tasks are actually decodable, rather than reporting only averaged benchmark scores.
- Estimating calibrated probabilities.
- Claiming full coverage of the entire ontology if only a subset is evaluable.
- Add a new analysis script, for example
jobs/per_term_eval.py. - Aggregate prediction outputs from HCP, IBC, and CNP into a single evaluation table.
- For each task in the reduced ontology, compute:
- number of evaluation maps tied to that task
- Recall@K
- rank statistics for the ground-truth term
- Produce:
- a per-task bar chart or heatmap
- a table of best-decoded and worst-decoded tasks
- Explicitly mark tasks with insufficient evaluation examples so they are not over-interpreted.
- Per-task decodability table.
- Figure summarizing term-level decoding performance.
Contextualize raw task/concept/domain scores with chance-level and permutation-based baselines.
- Formal probability calibration.
- Bayesian model comparison.
- Add a permutation procedure that shuffles ground-truth label assignments within each dataset.
- Recompute Recall@K under the null distribution for tasks, concepts, and domains.
- Estimate:
- empirical chance baseline
- p-value or percentile above null
- normalized accuracy = observed / chance
- Report how many terms are above chance in the per-term analysis.
- Add a simple table comparing observed versus chance performance across label levels.
- Permutation-based baseline outputs.
- Chance-normalized metrics.
- Count of above-chance decodable terms.
Explain why some terms decode better than others.
- Causal claims about ontology quality or article frequency.
- Full statistical modeling of all confounds.
- Build a term-level analysis table with one row per task.
- Add candidate explanatory variables:
- number of associated training articles
- definition length
- embedding norm or other simple text-feature proxies
- map specificity measures derived from evaluation maps
- Compute correlations and simple regression analyses between these variables and per-term Recall@K.
- Report whether article frequency, definition quality/length, or map specificity appears most associated with performance.
- Term-level feature table.
- Correlation/regression summary figure or table.
Substantiate the claim that the reduced/curated ontology improves decoding.
- Rebuilding the ontology from scratch.
- Exhaustive ontology curation.
- Export summary statistics for the full and reduced ontology:
- number of tasks
- number of concepts
- task-concept edges
- concept-domain edges
- Rerun a matched decoding/evaluation comparison under both ontologies.
- Compare performance for each model/configuration where the ontology changes are the only intended difference.
- Produce a supplementary table documenting what was retained, removed, or enriched in the reduced ontology.
- Ontology comparison table.
- Performance comparison under full versus reduced CogAt.
Inspect the shared latent space to determine whether aligned task and image embeddings form meaningful structure.
- Treating 2D projections as definitive evidence.
- Over-interpreting global geometry from UMAP/t-SNE alone.
- Add a new script, for example
jobs/embedding_geometry.py. - Extract:
- task text embeddings from the decoding vocabulary
- HCP image embeddings from the trained CLIP image encoder
- Produce 2D projections with UMAP and/or t-SNE.
- Color points by:
- cognitive domain for task embeddings
- task family for image embeddings
- Quantify auxiliary structure:
- within-domain versus between-domain distances
- distance from each image embedding to its matched task embedding
- comparison of geometry across BrainGPT, Mistral, and Llama variants
- Supplementary latent-space figure.
- Distance-based summary table.
Test whether subject-level underperformance is mainly due to lower SNR by varying HCP group size.
- Solving subject-level decoding in this revision.
- Training with synthetic noise augmentation unless needed as a later follow-up.
- Identify or generate HCP subject-level maps for the benchmark tasks.
- Build group-average maps for subset sizes
N = {5, 10, 20, 50, 100, 200, 787}. - For each group size:
- sample multiple subsets if possible
- decode each averaged map
- compute mean and variance of Recall@K
- Plot decoding performance versus group size.
- Compare the trend against the qualitative covariate-shift explanation to determine whether noise alone explains the gap.
- Group-size sensitivity figure.
- Quantitative statement about SNR versus text/image mismatch.
Use the existing ROI decoding setup to produce a concrete hypothesis-generation example centered on striatum-language associations.
- Claiming novel neurobiological discovery solely from the decoder.
- Replacing literature validation with decoding outputs.
- Repair and rerun
jobs/decoding_seeds.py. - Export top task, concept, and domain predictions for each ROI.
- For striatum specifically, record:
- top semantic/language tasks
- top concepts
- top domain probabilities
- Package the striatum results into a concise table suitable for the manuscript and a separate table for supplement use.
- Hand off the exact predicted labels and scores for downstream literature validation and meta-analytic discussion.
- Updated ROI decoding outputs.
- Striatum-specific results table for the hypothesis-generation example.
Probe the boundary of model generalization on a natural-scene perception dataset.
- Treating NSD as a core benchmark.
- Claiming scene-level semantic decoding if the ontology is mismatched.
- Only proceed if NSD maps are already available in a usable format.
- Define a small pilot set of maps expected to load strongly on visual perception.
- Run decoding with the existing perception-related ontology terms.
- Report the pilot qualitatively and quantitatively as a boundary case, not a headline result.
- Optional appendix-level NSD pilot result.
jobs/decoding_cnp.pyjobs/per_term_eval.pyjobs/null_baseline.pyjobs/embedding_geometry.pyjobs/snr_sweep.pydata/.../ground_truth_*.jsonor.csvfiles for HCP, IBC, and CNP mappingsresults/.../tables/andresults/.../figures/subdirectories for manuscript-ready outputs
If time is constrained, the minimum credible set for the revision is:
- Task 0: Pipeline hardening.
- Task 1: HCP benchmark reproduction.
- Task 2: IBC cross-dataset analysis.
- Task 3: CNP cross-dataset analysis.
- Task 5: Per-term decodability.
- Task 6: Null/chance baseline analysis.
- Task 8: Reduced versus full ontology comparison.
- Task 10: SNR/group-size analysis.
The embedding geometry, striatum deep dive, emotion expansion, and NSD pilot are valuable but can be treated as secondary if deadlines are tight.