Skip to content

Example: individual brain functional networks (HCP)

PAVI was developed to estimate the functional networks of each individual brain at the resolution of the cortical mesh, from resting-state fMRI (Le Bris et al., 2024). This page summarizes the approach and maps it to the code in experiments/.

Population-level and individual-level discrete parcellations into 17 functional networks

Why individual parcellations?

Functional networks (FNs) are usually mapped with group-level atlases, which assume the same topography for everyone. Yet the fine-grained organization of the cortex differs between individuals, and those differences relate to behavior and clinical conditions. Bayesian hierarchical models such as the MS-HBM (Kong et al., 2019) estimate individual parcellations with a population prior. However, their EM algorithm requires conjugate, closed-form updates and produces discrete parcellations only.

Framing the parcellation as variational inference on a hierarchical model lifts both limits: any distribution can be used, and the representation can be continuous. The challenge is scale: about 1,000 HCP subjects × 60,000 vertices × 17 networks is the problem PAVI solves.

The generative model

Inputs are functional connectivity (FC) profiles \(X^{s,n,t} \in \mathbb{R}^D\). For subject \(s\), vertex \(n\) and run \(t\), the profile holds the correlations between the vertex time series and \(D = 128\) DiFuMo regions.

Hierarchical generative model for individual functional parcellation

Variable Description Distribution
\(\mu_l \in \mathbb{R}^{L \times D}\) population FC profile of each network broad prior
\(\kappa \in \mathbb{R}^+\) FC variability broad prior
\(\theta^n \in \mathbb{R}^L\) population weights of vertex \(n\) for each network broad prior
\(\gamma_l \in \mathbb{R}^+\) inter-subject spatial variability of network \(l\) broad prior
\(\theta^{s,n} \in \mathbb{R}^L\) individual weights of vertex \(n\) \(\mathcal{N}(\theta^n_l, \gamma_l^2)\)
\(l^{s,n,t}\) network of vertex \(n\) during run \(t\) \(\mathrm{Categorical}(\mathrm{logits} = \theta^{s,n})\)
\(X^{s,n,t}\) observed FC profile \(\mathcal{N}(\mu_{l^{s,n,t}}, \kappa)\)

Three design choices:

  • Mixture of networks: each vertex's FC profile comes from one of \(L = 17\) networks (as in the Yeo atlas). The label can change between runs, which captures network overlap.
  • Topography as the individual signal: all inter-subject variability is carried by \(\theta^{s,n}\), the individual's continuous, probabilistic map of each network.
  • Homology through the population prior: \(\theta^{s,n}\) is centered on the population map \(\theta^n\), which keeps networks comparable across subjects.

Inference with PAVI

Model component pavi choice
\(\theta^{s,n}\): 60M instances in plates (subjects, vertices) conditional_affine, encodings from FactorizedEM (concatenated subject and vertex encodings)
population variables (\(\mu_l\), \(\theta^n\), \(\gamma\), \(\kappa\)) affine; positive variables get log-normal posteriors through the support bijection
discrete labels \(l^{s,n,t}\) marginalized by enumeration (TraceEnum_ELBO), hidden from the guide
scale stochastic VI over subjects and vertices (PlateSampler, idx)
convergence KL annealing (AnnealingScheduleCallback)
scheme NormalizingFlowScheme

In other words, the brain application uses the mean-field approximation: a standard normal base and diagonal affine transforms. Richer posteriors (e.g. autoregressive flows) brought no improvement in this application, while being much slower to train.

Outputs

Population-level probabilistic maps of functional networks VIN-1 to CON-2 Population-level probabilistic maps of functional networks CON-3 to DMN-4

  • Individual maps \(\hat\theta^{s,n}\): weighted parcellations, or probabilistic ones after a softmax across networks, one per network and subject.
  • Population atlas \(\hat\theta^n\): a data-driven weighted atlas from which all individual maps derive (above, 17 networks from 400 HCP subjects).
  • Inter-subject variability \(\hat\gamma_l\), mapped on the cortex by weighting each network's variability by its local probability.
  • Intra-subject variability: the normalized entropy of the label distribution at each vertex, which measures network overlap.

Inter- and intra-subject topographic variability of the networks

Transfer to new subjects and datasets

The shared networks and the population-level posteriors learned on a large dataset can be frozen. Only the encodings of the new subjects are then optimized (see concepts). As shown by Le Bris et al. (2024), this gives good parcellations on small datasets and improves behavior prediction:

Benefits of transfer learning on the Cam-CAN dataset

Main results

  1. A data-efficient, scalable method for continuous, probabilistic, vertex-level individual parcellations that capture the overlapping and graded nature of functional networks.
  2. Individual topography matters: fine-grained network organization is highly individual-specific and cannot be represented by group atlases.
  3. Topography predicts behavior and complements the functional connectome.
  4. Transfer learning through population priors makes the model applicable to small external datasets (Cam-CAN, ABIDE I).
  5. Functional organization is overlapping, and this overlap is behaviorally relevant.

Running the experiments

The code is in experiments/. It requires the experiments dependency group and preprocessed HCP data: experiments/src/settings.py points to the data location, so adapt it to your system.

Piece Location
Models (ModelS, ModelG, ModelGS, …: variants of the hierarchical model) experiments/src/models/models_fcon.py
Datasets and plate-aware data loaders experiments/src/datasets/datasets_fcon.py
Experiment configuration (hydra-zen): model, guide, encodings, data, trainer experiments/configs/experiment_test.py
Training uv run python -m experiments.scripts.training
Inference on new subjects (frozen guide, subject encodings refitted) uv run python -m experiments.scripts.inferring <checkpoint>
Posterior sampling to NetCDF experiments/scripts/sampling.py (main(experiment_name, run_name, epoch))
Analysis notebook (brain maps, behavior prediction) experiments/notebooks/experiment_fcon_test.ipynb

Runs are written to experiments/outputs/<experiment>/<run>/: the resolved config, Lightning checkpoints and posterior samples. MLflow tracking goes to experiments/outputs/mlflow.db.

Reference

Le Bris, A., Rouillard, L., & Wassermann, D. (2024). Improving Individual-Specific Functional Parcellation through Transfer Learning. hal-04506561.