MRAE learns a shared low-dimensional manifold from fMRI timeseries data using a manifold-regularized autoencoder. A pre-computed embedding (e.g., from PHATE, TPHATE, or PCA) is used to regularize the autoencoder's bottleneck, aligning its latent space with the target manifold geometry.
MRMDAE is a variant of a MRAE that allows for multi-subject alignment. It is a type of network with a single encoder, which learns to jointly encode all subjects timeseries data together (granted they are temporally aligned), and reconstruct the data in subject-space through multiple decoders. See architecture here:
Based on: https://arxiv.org/abs/2201.00622
Note that PHATE/TPHATE etc are not required for installing this package. Please install separately with pip if needed. They will be needed to run the example notebooks.
import mrae
from mrae import ManifoldRegularizedAutoencoder
from mrae.dataHandler import LoadVolumeAndEmbedDataset_single
# Load data and pre-computed manifold embedding
dataset = LoadVolumeAndEmbedDataset_single(data, embedding)
# Initialize and train
model = ManifoldRegularizedAutoencoder(
hidden_dim=64,
manifold_dim=10,
IO_dim=dataset.get_voxel_dims()[0],
)
model.train(dataset)
# Project new data onto learned manifold
projections = model.extract_projection_to_manifold(new_data)from mrae import MRMDAE
from mrae.dataHandler import LoadVolumeAndEmbedDataset_multi
dataset = LoadVolumeAndEmbedDataset_multi(data_paths, embed_paths, TRs)
model = MRMDAE(
hidden_dim=64,
manifold_dim=10,
IO_dim=dataset.get_voxel_dims()[0],
n_decoders=n_subjects,
)
model.train(dataset)pip install mrae
Or install from source:
git clone https://github.com/ericabusch/MRAE
cd MRAE
pip install -e .
