Beauchamp:TensorECOG
Template:PAGE UNDER CONSTRUCTION
Regularized Higher-Order Partial Least Squares Analysis for ECoG Data
By Frederick Campbell and Kelly Geyer\\ June 21, 2017
Introduction
This page contains documentation of our MATLAB package for the tensor factorization algorithm Regularized Higher-Order Partial Least Squares (RHOPLS). This algorithm is specifically designed for electrocorticography (ECoG) data, with dimensions consisting of electrodes, epoch time, and frequency.
Current capabilities:
- Data pre-processing: multiple methods for scaling data and removing outlier trails
Upcoming capabilities:
- RHOPLS algorithm implementation
- Visualization of final factorization results, along with capabilities to view data during processing. Potential functionality for SUMA visualization
Processing ECoG Data for Analysis
%% PARAMETERS
% 1. data_dir: Directory containing folders (labeled as patient initials)
% 2. rhopls_dir: RHOPLS toolbox directory
% 3. patient: Patient initials, also name of folder containing patient
% data. Inside this directory are three files:
% '<patient_initials>_TFR_ao_LowFreq.m', '<patient_initials>_TFR_ao.mat',
% and '<patient_initials>_trial_labels.mat'
data_dir = '/Users/beauchamplab/Documents/kg_stuff/for_kelly';
rhopls_dir = '/Users/beauchamplab/Documents/kg_stuff/for_kelly/open-source-rhopls/rhopls_code';
patient = 'YAK';
%% Set up required paths
% Install RHOPLS package
cd(rhopls_dir);
addpath(pwd);
savepath;
% Install required toolboxes
rhopls_setup();
% Check contents of patient directory
patient_dir = fullfile(data_dir, patient);
%% Load and process ECoG data
% Import design matrix for patient k
% Create the data matrix that we use for patient k
% Description of data loaded: This is a 3-dimensional tensor
% Dimensions: (trials X label) - Fred's data
std_method = 'flatten_trials';
center = true;
scaled = true;
rm_outliers = true;
overwrite = true;
verbose = true;
[X, trial_labels, metadata] = load_patient_data(patient_dir, ...
'standardizationMethod', std_method, ...
'center', center, ...
'scaled', scaled, ...
'removeOutliers', rm_outliers, ...
'overwrite', overwrite, ...
'verbose', verbose);
ECoG RHOPLS
parameter tuning, fit model
Results
do analysis here, show plots