ZscoreNorm#

class dpeeg.transforms.ZscoreNorm(train_for_test: bool = False, mean: ndarray | None = None, std: ndarray | None = None, dim: int | None = None)[source]#

Z-score normalization per subject.

By default, the EEG data (edata) of eegdata are normalized.

\[\mathbf{z} = \frac{\mathbf{x} - \mu}{\sqrt{\sigma^{2}}}\]

where \(\mathbf{x}\) and \(\mathbf{z}\) denote the input data and the output of normalization, respectively. \(\mu\) and \(\sigma^2\) represent the mean and variance values of the sample.

Parameters:
  • train_for_test (bool) – If True, normalize the test set using the values in the training set.

  • mean (ndarray, optional) – The mean used in the normalization process. If None, use the statistics of the current sample for normalization. Ignored when train_for_test is True.

  • std (ndarray, optional) – The standard deviation used in the normalization process. If None, use the statistics of the current sample for normalization. Ignored when train_for_test is True.

  • dim (int, optional) – The dimension to normalize. Usually, -1 for channels and -2 for time points. If None, normalize at the sample level.

Returns:

data – Transformed eegdata.

Return type:

eegdata or dataset