Beauchamp:TensorECOG: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
(Blanked the page)
Tag: Blanking
 
(91 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{PAGE UNDER CONSTRUCTION}}


==Regularized Higher-Order Partial Least Squares Analysis for ECoG Data==
By Frederick Campbell and Kelly Geyer, June 2017
; kelly.l.geyer@rice.edu
=Introduction=
This page contains documentation of our MATLAB package for the tensor factorization algorithm Regularized Higher-Order Partial Least Squares (RHOPLS) and Principal Component Analysis (RHOPCA).  These algorithms are specifically designed for electrocorticography (ECoG) data, with dimensions consisting of trials, electrodes, epoch time, and frequency.
====Current capabilities:====
# Data pre-processing: multiple methods for scaling data and removing outlier trails
# Regularized Higher-Order PCA: Implementation of RHOPCA for ECoG data
# Regularized Higher-Order PLS: Implementation of RHOPLS for ECoG data
# Parameter tuning for RHOPLS: Tuning function to select best parameters for RHOPLS
====Upcoming capabilities:====
# R wrapper functions: Ability to use this package in R
# Integration with RAFE: Ability to visualize RHOPCA heatmaps with RAFE tool, as well as SUMA
=Requirements=
====Required Software:====
# R
# MATLAB toolbox named rhop_code
This package is available on the GitLab page https://gitlab.com/klgeyer/rhop. This is currently a private page so please contact Kelly Geyer to obtain an invitation to page or current copy of code.
====Configuration for Mac OSX====
1. Create terminal command 'matlab' by typing the following lines in the terminal. For example <path to matlab bin> could be "/Applications/MATLAB_R2015a.app/bin"
<code>
    $ export PATH=$PATH:<path to matlab bin>
    $ source ~/.bash_profile
</code>
Test this by typing the following, which should return "<path to matlab bin>/matlab"
<code>
    $ which matlab
</code>
2. Configure variables for rhopls_code
Find the file 'config.yaml' in rhopls_code and edit the variables as necessary
====Install Package====
Install the MATLAB package with the following commands, which are use to include at the beginning of any .m script that uses this package
<code>
    % Install RHOPLS package
    cd(rhopls_dir);
    addpath(pwd);
    savepath;
    % Install required toolboxes
    rhopls_setup();
</code>
==Processing ECoG Data for Analysis==
The RHOPLS package provides several methods of data standardization and outlier trial removal. The function <code>load_patient_data</code> implements these in a user-friendly wrapper. Ultimately it creates the design matrix for a single patient, which is actually a 4-dimensional tensor with dimensions (trials x electrode x freq x time). This function not only returns the design tensor, trail labels and metadata, but saves them to the original data folder.
Data standardization methods:
# <code>none</code>: When using the <load_patient_data> function this avoids implementing any standardization. However, it is not an option for the <code>standardize_data</code> function
# <code>flatten_trials</code>: This function flattens the ECoG tensor by trial, or first dimension, and then centers and scales data according by user options
# <code>array_normal</code>: This function  centers and scales data using the array normal method, according by user options. The array normal distribution is a higher-order generalization of the multivariate normal distribution. We estimate a mean and covariance assuming the tensor was generated via the array normal distribution and use the estimated parameters to center and scale the tensor.
In following example, we mean center and scale the flattened tensor to standardize it. Additionally, outlier are removed. Users can also choose to set either center and scale to false.
<code>
    %% Load and process ECoG data
    % Import and create a design tensor for patient k
    std_method = 'flatten_trials';
    center = true;
    scaled = true;
    rm_outliers = true;
    [X, trial_labels, metadata] = load_patient_data(patient_dir, ...
                        'standardizationMethod', std_method, ...
                        'center', center, ...
                        'scaled', scaled, ...
                        'removeOutliers', rm_outliers);
</code>
==ECoG RHOPLS==
parameter tuning, fit model
==Results==
do analysis here, show plots
==References==
# Frederick Campbell, "Interpretable Brain Decoding for Electrocorticography Data though Regularized High Order Partial Least Squares." Publication in progress.
# Brett W. Bader, Tamara G. Kolda and others. MATLAB Tensor Toolbox Version 2.6, Available online, February 2015. URL: http://www.sandia.gov/~tgkolda/TensorToolbox/.

Latest revision as of 21:03, 24 November 2020