-
Notifications
You must be signed in to change notification settings - Fork 5
Temporal Generalization Matrix
To evaluate the stability of brain patterns along time, temporal generalization analyses are commonly used. To obtain the temporal generalization matrix, the model is trained in a specific temporal point, testing its ability to discriminate between conditions in the whole temporal window. This process is then repeated for every timepoint thus obtaining the final decoding accuracy matrix (see Figure 1).
Figure 1. Temporal generalization matrix: the classification model is trained with data at certain time point (black square). This model is then tested along the remaining time points (grey square), repeating this process for each time point inside the epoch. As a result, the group-level temporal generalization matrix (area under the ROC curve) is showed for an SVM classifier when 8 trials were averaged to generate the input dataset. Above-chance significant clusters are highlighted using black lines.
An above-chance discrimination rate outside the diagonal of the matrix suggests that the same activity pattern is sustained in time. This phenomenon is usually interpreted as a reactivation of neural representations. Therefore, if there is no evidence of temporal generalization, different patterns of activity can be inferred.
Note. a recent study demonstrated that this interpretation is not always valid, suggesting that this phenomenon can be explained as an artefact of the manner in which the decoding accuracy provided by different components of the signal combine to bring about the overall decoding accuracy [1].
Regardless of the selected type of analysis (MVPA or MVCC), the calculation of the temporal generalization matrix can be enabled in the MVPAlab configuration structure as follows:
cfg_file.m
%% Basic configuration file for MVPA analysis - Folder and data files:
cfg.analysis = 'MVPA';
cfg.location = pwd;
% Condition indentifiers:
cfg.study.conditionIdentifier{1,1} = 'condition_a';
cfg.study.conditionIdentifier{1,2} = 'condition_b';
% Data paths:
cfg.study.dataPaths{1,1} = 'C:\Users\Cimcyc\Desktop\data\condition_a\';
cfg.study.dataPaths{1,2} = 'C:\Users\Cimcyc\Desktop\data\condition_b\';
% Data files:
cfg.study.dataFiles{1,1} = {'1.mat','2.mat','3.mat'};
cfg.study.dataFiles{1,2} = {'1.mat','2.mat','3.mat'};
%% Enable temporal generalization matrix:
cfg.classmodel.tempgen = true;
Please, note that asymmetrical windows can be defined to compute the temporal generalization matrix. In this case, both the training and testing time windows should be defined:
% Train window:
cfg.tm.tpstart = 0;
cfg.tm.tpend = 200;
% Test window:
cfg.tm.tpstart_ = 400;
cfg.tm.tpend_ = 800;
And finally, the following scripts generate a graphic representation of the result:
% Initialize and configure plots:
graph = mvpalab_plotinit();
% Load results if needed:
load results/temporal_generalization/acc/result.mat
% Colors:
graph.colorMap = graph.grads.earth;
graph.colors = graph.colors.earth;
% Axis limits:
graph.xlim = [-100 1500];
graph.ylim = [-100 1500];
graph.caxis = [.3 .7];
graph.onscreen = [0 190];
% Axes labels and titles:
graph.xlabel = 'Train (ms)';
graph.ylabel = 'Test (ms)';
graph.title = 'Demo plot (no statistical significance)';
% Mean accuracy TG plot (no statistical significance):
figure;
hold on;
mvpalab_plottempogen(graph,cfg,result);
% Initialize and configure plots:
graph = mvpalab_plotinit();
% Load results if needed:
load results/temporal_generalization/acc/result.mat
load results/temporal_generalization/acc/stats.mat
% Plot significant clusters (above and below chance):
graph.stats.above = true;
graph.stats.below = true;
% Significant indicator:
graph.sigh = .4;
% Colors:
graph.colorMap = graph.grads.earth;
graph.colors = graph.colors.earth;
% Axis limits:
graph.xlim = [-100 1500];
graph.ylim = [-100 1500];
graph.caxis = [.3 .7];
graph.onscreen = [0 190];
% Axes labels and titles:
graph.xlabel = 'Train (ms)';
graph.ylabel = 'Test (ms)';
graph.title = 'Demo plot (statistical significance)';
% Mean accuracy TG plot (statistical significance):
figure;
hold on;
mvpalab_plottempogen(graph,cfg,result,stats);
- Defining a configuration file
- Participants and data directories
- Trial average
- Balanced dataset
- Data normalization
- Data smoothing
- Analysis timing
- Channel selection
- Dimensionality reduction
- Classification model
- Cross-validation
- Performance metrics
- Parallel computation
- Sample EEG dataset
- Multivariate Pattern Analysis
- Multivariate Cross-Classification
- Temporal generalization matrix
- Feature contribution analysis
- Frequency contribution analysis