CommonSpatialPatterns¶
Extract signal components whose variance optimally discriminates between two conditions.
This filter can be used as an adaptive preprocessing step for a multichannel signal, such as EEG, EMG, or MEG, whose variance shall subsequently be used in a classification setup (e.g., to predict some binary target variable, for instance in order to discriminate between two possible cognitive states). The resulting components will usually yield better spectral features than the raw channels, leading to better classification accuracy. This node will calibrate itself if it receives a non-streaming ( offline) chunk that has a time, space, and instance axis, and which has a target value for each instance (similarly to how machine learning nodes operate). Instances correspond to labeled trials, the space axis represents the channels which are being filtered, and time are the time points of each trial segment. Note that CSP must be preceded by a bandpass filter (e.g., FIR or IIR prior to segmentation) that restricts the signal to the frequency band of interest. CSP only works for two classes. CSP and its variants are the standard approach for spatial filtering in such settings, particularly in the brain-computer interface field. Tip: a continuous time series with markers can be segmented into multiple labeled trials / segments using the Assign Target Markers node followed by the Segmentation node. Note that the train data and the test data must have the same name in the Packet (i.e., "eeg") in order for the CSP node to match them. More Info... Version 1.0.1
Ports/Properties¶
data¶
Data to process.
- verbose name: Data
- default value: None
- port type: DataPort
- value type: Packet (can be None)
- data direction: INOUT
nof¶
Number of spatial pattern pairs to compute. This determines the number of output channels (which is 2x this value) and thus the dimensionality of the feature space. Typical values are 2-4; while one can generate more features (up to the number of input channels), these will be increasingly less useful to the classifier.
- verbose name: Number Of Pattern Pairs
- default value: 3
- port type: IntPort
- value type: int (can be None)
shrinkage¶
Shrinkage coefficient for covariance matrix estimation.
- verbose name: Shrinkage
- default value: 0
- port type: FloatPort
- value type: float (can be None)
ratio_formulation¶
Use the ratio CSP formulation instead of the standard one. This is an experimental feature that requires a pre-stimulus baseline to be included.
- verbose name: Ratio Formulation
- default value: False
- port type: BoolPort
- value type: bool (can be None)
initialize_once¶
Do not recalibrate on subsequent offline chunks, even if they include target labels. If False, this node will recalibrate itself on any offline chunk that has data plus target labels.
- verbose name: Calibrate Only Once
- default value: True
- port type: BoolPort
- value type: bool (can be None)
cond_field¶
The name of the instance data field that contains the conditions to be discriminated. This parameter will be ignored if the packet has previously been processed by a DescribeStatisticalDesign node.
- verbose name: Cond Field
- default value: TargetValue
- port type: StringPort
- value type: str (can be None)
verbose¶
Produce verbose output.
- verbose name: Verbose
- default value: False
- port type: BoolPort
- value type: bool (can be None)
set_breakpoint¶
Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.
- verbose name: Set Breakpoint (Debug Only)
- default value: False
- port type: BoolPort
- value type: bool (can be None)
metadata¶
User-definable meta-data associated with the node. Usually reserved for technical purposes.
- verbose name: Metadata
- default value: {}
- port type: DictPort
- value type: dict (can be None)