Skip to main content

A python package for multivariate pattern dependence

Project description

PyMVPD LITE

PyMVPD LITE: A LITE version of MultiVariate Pattern Dependence (MVPD) analysis in Python

MVPD Model Family

  1. Linear Regression Models
  • L2_LR: linear regression model with L2 regularization
  • PCA_LR: linear regression model with no regularization after principal component analysis (PCA)

Installation & Dependencies

The easiest way to install the package is to execute (possibly in a new virtual environment) the following command:

pip install PyMVPD-LITE

You can also install from the GitHub repository to get the most up-to-date version.

git clone https://github.com/sccnlab/PyMVPD_LITE.git
pip install -r requirements.txt

The following packages need to be installed to use PyMVPD LITE:

  • python >= 3.6
  • nibabel>=3.2.1
  • numpy>=1.19.3
  • scikit-learn>=0.20.1
  • scipy>=1.1.0

Tutorial

Test Dataset

Data of one subject from the StudyForrest dataset.

Predictor ROI: FFA - fusiform face area,

Target ROI: GM - gray matter.

  • Raw data were first preprocessed using fMRIPrep and then denoised by using CompCor (see more details in Fang et al. 2019).

Example Analyses and Scripts

To give a quick try for MVPD analysis, you can directly run our example script run_MVPD.py:

cd exp/
python3 run_MVPD.py

We have also provided a tutorial in jupyter notebook. Feel free to check it out!

Customization

To generate your own scripts, please follow the three steps:

import os
from mvpdlite import data_loading, model_exec

Step 1 - Analysis Specification

sub='sub-01' # subject whose data are to be analyzed
total_run=XX # total number of experimental runs

# Input functional Data
filepath_func=[]
filepath_func+=['path/to/functional/data/run1.nii.gz']
filepath_func+=['path/to/functional/data/run2.nii.gz']
......

# Input predictor ROI mask and target ROI mask
filepath_mask1='path/to/predictor/ROI/mask.nii.gz'
filepath_mask2='path/to/target/ROI/mask.nii.gz'

base1=os.path.basename(filepath_mask1)
base2=os.path.basename(filepath_mask2)
roi_1_name=base1.split('.nii')[0]
roi_2_name=base2.split('.nii')[0]

# Output Directory
roidata_save_dir='path/to/save/roidata/'
results_save_dir='path/to/save/results/'

# Choose MVPD model
model_type='L2_LR' # ['PCA_LR', 'L2_LR']

# Set model parameters
# Only for PCA_LR
num_pc=3 # number of principal components used 
# Only for L2_LR
alpha=0.01 

# Save predicted timecourses
save_prediction=False # default

Step 2 - Data Loading

data_loading.load_data(sub, total_run, roi_1_name, roi_2_name, filepath_func, filepath_mask1, filepath_mask2, roidata_save_dir)

Step 3 - Analysis Execution

model_exec.MVPD_exec(model_type, sub, total_run, alpha, num_pc, roidata_save_dir, roi_1_name, roi_2_name, filepath_func, filepath_mask1, filepath_mask2, results_save_dir, save_prediction)

Contact

Reach out to Mengting Fang (mtfang0707@gmail.com) for questions, suggestions and feedback!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyMVPD_LITE-0.0.2.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

PyMVPD_LITE-0.0.2-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file PyMVPD_LITE-0.0.2.tar.gz.

File metadata

  • Download URL: PyMVPD_LITE-0.0.2.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.5.0.1 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for PyMVPD_LITE-0.0.2.tar.gz
Algorithm Hash digest
SHA256 a08a60381a4b9f6b3109ec59fdb6258bc8262d20b6a1bd214f06952acc0aa00f
MD5 5072a04947207d076dfed6936648af6d
BLAKE2b-256 67185a76838f25e7e3f48b3578482c2f30cb7ac3a9aa41ad325b347053ff9270

See more details on using hashes here.

File details

Details for the file PyMVPD_LITE-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: PyMVPD_LITE-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.5.0.1 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for PyMVPD_LITE-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4e2e9a63630c8e7bcf39774fdc908e8da1d688562b510da9f9928caa4ac4d46b
MD5 295e2afe446a5128b1e68b8555d0f31b
BLAKE2b-256 4ee1c797b1b21368cc8fdae3b7b8a4e8dfd38ff06f24e1f22d57795abfab1097

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page