ZScoreNormalize¶
- class torch_ecg._preprocessors.ZScoreNormalize(mean: Real | ndarray = 0.0, std: Real | ndarray = 1.0, per_channel: bool = False, **kwargs: Any)[source]¶
Bases:
Normalize
Z-score normalization.
Z-score normalization defined as
\[\left(\frac{sig - \operatorname{mean}(sig)}{\operatorname{std}(sig)}\right) \cdot s + m\]- Parameters:
mean (numbers.Real or numpy.ndarray, default 0.0) – Mean value of the normalized signal, or mean values for each lead of the normalized signal.
std (numbers.Real or numpy.ndarray, default 1.0) – Standard deviation of the normalized signal, or standard deviations for each lead of the normalized signal.
per_channel (bool, default False) – If True, normalization will be done per channel.
Examples
from torch_ecg.cfg import DEFAULTS sig = DEFAULTS.RNG.randn(1000) pp = ZScoreNormalize() sig, _ = pp(sig, 500)