roiextract.pipeline.SVDAggregation#
- class roiextract.pipeline.SVDAggregation(n_components=1)#
SVD-based aggregation of reconstructed source time courses within the ROI. The time courses that correspond to the first
n_componentssingular vectors are selected as the representative time courses of the ROI.- Parameters:
- n_components
int, default=1 The number of SVD components to retain for each ROI.
- n_components
Methods
copy()Create a copy of the pipeline step.
fit(data, src, labels)Fit the SVD aggregation step to the provided data, source space, and labels.
fit_transform(data, src, labels)Fit and apply the SVD aggregation to the provided data, source space, and labels.
get_names(names)Get the names of the rows of the weight matrix, which correspond to the extracted time courses for each label and SVD component.
Get the parameters of the SVD aggregation step as a dictionary.
Get the weight matrix corresponding to the resulting SVD aggregation transformation.
transform(data)Apply the fitted SVD aggregation to the provided data.
- copy()#
Create a copy of the pipeline step.
- Returns:
- copy
PipelineStep A copy of the pipeline step.
- copy
- fit(data, src, labels)#
Fit the SVD aggregation step to the provided data, source space, and labels.
- Parameters:
- data
SourceEstimate The source estimate containing the reconstructed source time courses.
- src
SourceSpaces The definition of the considered source space for inverse modeling.
- labels
Label|listofLabel The label or list of labels defining the ROIs for which time courses should be extracted.
- data
- Returns:
- self
SVDAggregation The fitted aggregation step.
- self
- fit_transform(data, src, labels)#
Fit and apply the SVD aggregation to the provided data, source space, and labels.
- Parameters:
- data
SourceEstimate The source estimate containing the reconstructed source time courses.
- src
SourceSpaces The definition of the considered source space for inverse modeling.
- labels
Label|listofLabel The label or list of labels defining the ROIs for which time courses should be extracted.
- data
- Returns:
- label_tc
array, shape (n_labels * n_components, n_times) The extracted time courses for each label and SVD component.
- label_tc
- get_names(names)#
Get the names of the rows of the weight matrix, which correspond to the extracted time courses for each label and SVD component.
- Parameters:
- Returns:
- get_params()#
Get the parameters of the SVD aggregation step as a dictionary.
- Returns:
- params
dict The parameters of the aggregation step, including the number of SVD components to retain for each ROI.
- params
- get_weights()#
Get the weight matrix corresponding to the resulting SVD aggregation transformation.
- Returns:
- weights
array The weight matrix that contains the SVD-based weights for each ROI and component.
- weights
- transform(data)#
Apply the fitted SVD aggregation to the provided data. Unlike other built-in aggregation methods, this method does not use MNE-Python’s
mne.extract_label_time_course()function, since it only allows extracting the first SVD component. Instead, the method applies the fitted weight matrix to the data to obtain the SVD-based time courses.In case of one SVD component per ROI, the result should match the output of
mne.extract_label_time_course()withmode="pca_flip"up to a sign flip and scaling factor.- Parameters:
- data
SourceEstimate The source estimate containing the reconstructed source time courses.
- data
- Returns:
- label_tc
array, shape (n_labels * n_components, n_times) The extracted time courses for each label and SVD component. For label i, the time courses of corresponding SVD components are located at rows
i * n_componentsto(i + 1) * n_components - 1.
- label_tc