- Jupyter Notebook 92%
- Python 8%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Manifold Regularized Autoencoder (MRAE) and multi-subject variant (MRMDAE) for learning shared low-dimensional manifolds from fMRI timeseries data. Includes pip packaging, example notebooks, and Sherlock dataset. |
||
| MRAE | ||
| .gitignore | ||
| image.png | ||
| pyproject.toml | ||
| README.md | ||
| requirements.txt | ||
| setup.cfg | ||
| setup.py | ||
Manifold Regularized Autoencoder (MRAE)
Quick Start
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.
Single-subject (MRAE)
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)
Multi-subject (MRMDAE)
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)
Installation
pip install mrae
Or install from source:
git clone https://github.com/ericabusch/MRAE
cd MRAE
pip install -e .
