Ensemble empirical mode decomposition (EEMD) creates an ensemble of worker each of which performs an EMD on a copy of the input signal with added noise. When all workers finish their work a mean over all workers is considered as the true result.
Given the nature of EEMD, each time you decompose a signal you will obtain a different set of components.
That’s the expected consequence of adding noise which is going to be random.
To make the decomposition reproducible, one needs to set a seed for the random number generator used in EEMD.
This is done using
PyEMD.EEMD.noise_seed() method on the instance.
EEMD(trials: int = 100, noise_width: float = 0.05, ext_EMD=None, parallel: bool = False, **kwargs)¶
Ensemble Empirical Mode Decomposition
Ensemble empirical mode decomposition (EEMD) [Wu2009] is noise-assisted technique, which is meant to be more robust than simple Empirical Mode Decomposition (EMD). The robustness is checked by performing many decompositions on signals slightly perturbed from their initial position. In the grand average over all IMF results the noise will cancel each other out and the result is pure decomposition.
- trials : int (default: 100)
Number of trials or EMD performance with added noise.
- noise_width : float (default: 0.05)
Standard deviation of Gaussian noise (\(\hat\sigma\)). It’s relative to absolute amplitude of the signal, i.e. \(\hat\sigma = \sigma\cdot|\max(S)-\min(S)|\), where \(\sigma\) is noise_width.
- ext_EMD : EMD (default: None)
One can pass EMD object defined outside, which will be used to compute IMF decompositions in each trial. If none is passed then EMD with default options is used.
- parallel : bool (default: False)
Flag whether to use multiprocessing in EEMD execution. Since each EMD(s+noise) is independent this should improve execution speed considerably. Note that it’s disabled by default because it’s the most common problem when EEMD takes too long time to finish. If you set the flag to True, make also sure to set processes to some reasonable value.
- processes : int or None (optional)
Number of processes harness when executing in parallel mode. The value should be between 1 and max that depends on your hardware.
- separate_trends : bool (default: False)
Flag whether to isolate trends from each EMD decomposition into a separate component. If true, the resulting EEMD will contain ensemble only from IMFs and the mean residue will be stacked as the last element.
[Wu2009] Z. Wu and N. E. Huang, “Ensemble empirical mode decomposition: A noise-assisted data analysis method”, Advances in Adaptive Data Analysis, Vol. 1, No. 1 (2009) 1-41.
A dictionary with all computed imfs per given order.
eemd(S: numpy.ndarray, T: Optional[numpy.ndarray] = None, max_imf: int = -1) → numpy.ndarray¶
Performs EEMD on provided signal.
For a large number of iterations defined by trials attr the method performs
emd()on a signal with added white noise.
- S : numpy array,
Input signal on which EEMD is performed.
- T : numpy array or None, (default: None)
If none passed samples are numerated.
- max_imf : int, (default: -1)
Defines up to how many IMFs each decomposition should be performed. By default (negative value) it decomposes all IMFs.
- eIMF : numpy array
Set of ensemble IMFs produced from input signal. In general, these do not have to be, and most likely will not be, same as IMFs produced using EMD.
emd(S: numpy.ndarray, T: numpy.ndarray, max_imf: int = -1) → numpy.ndarray¶
Vanilla EMD method.
Provides emd evaluation from provided EMD class. For reference please see
ensemble_count() → List[int]¶
Count of imfs observed for given order, e.g. 1st proto-imf, in the whole ensemble.
ensemble_mean() → numpy.ndarray¶
Pointwise mean over computed ensemble. Same as the output of eemd() method.
ensemble_std() → numpy.ndarray¶
Pointwise standard deviation over computed ensemble.
generate_noise(scale: float, size: Union[int, Sequence[int]]) → numpy.ndarray¶
Generate noise with specified parameters. Currently supported distributions are:
- normal with std equal scale.
- uniform with range [-scale/2, scale/2].
- scale : float
Width for the distribution.
- size : int
Number of generated samples.
- noise : numpy array
Noise sampled from selected distribution.
get_imfs_and_residue() → Tuple[numpy.ndarray, numpy.ndarray]¶
Provides access to separated imfs and residue from recently analysed signal.
- (imfs, residue) : (np.ndarray, np.ndarray)
Tuple that contains all imfs and a residue (if any).
noise_seed(seed: int) → None¶
Set seed for noise generation.