facebookresearch / deepmeg-recurrent-encoder

deepmeg recurrent encoder
Other
24 stars 6 forks source link

DeepMEG-Encoding project

This project investigates models for forecasting MEG data, using past MEG and external stimuli. These models range from linear to nonlinear, with or without access to the initial brain state, and conclude with our Deep Recurrent Encoder (DRE) architecture. The DRE outperforms current methods and trains across subjects simulatenously. An ablation study yields insight into the modules which best explain its predictive performance. A simple feature importance analysis helps interpret what the deep architecture learns.

Predictive Performance Feature Importance

General information

You will need Python >= 3.7 to use this code.

Install Python package requirements with:

pip install -r requirements.txt

Find help with:

python3 -m neural --help

Data extraction

First, install the MOUS dataset from https://data.donders.ru.nl/collections/di/dccn/DSC_3011020.09_236?3 To do so, you may register via your orchid account.

To extract MEG and stimuli from the MOUS dataset:

python3 -m neural.extraction --data /path/to/dataset --out /path/to/extraction

Notes:

Then, proceed to train encoding models.

Train the Deep Recurrent Encoder (DRE)

To train the DRE:

python3 -m neural --data /path/to/extraction/full --out /path/to/metrics

The ablations of the DRE (resp. "NO-CONV", "PCA", "NO-SUB", "NO-INIT") in the paper were trained using:

python3 -m neural --data /path/to/extraction --out /path/to/metrics --epochs 40 --conv-layers=0
python3 -m neural --data /path/to/full/extraction --out /path/to/metrics --pca 40
python3 -m neural --data /path/to/full/extraction --out /path/to/metrics --subject-dim=0
python3 -m neural --data /path/to/full/extraction --out /path/to/metrics --meg-init 0

Train the Linear Encoders (TRF, RTRF)

python3 -m neural.linear --with-forcing --with-init --shuffle --out /path/to/metrics

License

This repository is released under the CC-BY-NC 4.0. license as found in the LICENSE file.