laszukdawid / PyEMD

Python implementation of Empirical Mode Decompoisition (EMD) method
https://pyemd.readthedocs.io/
Apache License 2.0
867 stars 224 forks source link

Why are the imfs obtained using the two methods different? #118

Closed ki-ljl closed 2 years ago

ki-ljl commented 2 years ago

I am trying to CEEMDAN the load data, the code is written in the following two ways:

ceemdan = CEEMDAN()
ceemdan.ceemdan(load)
imfs, res = ceemdan.get_imfs_and_residue()

and

ceemdan = CEEMDAN()(load)
imfs, res = ceemdan[:-1], ceemdan[-1]

I found that the results obtained by the two ways of writing are inconsistent, so which way of writing is better?

ki-ljl commented 2 years ago

Specifically, the order of magnitude of the 'residue' in method 1 is large, while the order of magnitude of the 'residue' in method 2 is small.

M73ACat commented 2 years ago

Hello :) I have checked the problem both in versions 0.2.10 and 1.2.3. And the conclusions are as follows:

  1. For your question that “which way of writing is better”, generally, the latter is correct.
  2. I think this problem may be a little bug or variable miss using. The residue in EMD variants should be the remaining part of the decomposition that cannot be decomposed. And in the PyEMD, the residue is the final part of the final IMFs.
  3. However, in the program, the ‘residue’ returned by the ceemdan.get_imfs_and_residue() is defined as S * scale_s - np.sum(self.C_IMF, axis=0) (line 255), which means the difference between the original signal and the sum of all IMF components. Such difference is regarded as the reconstruction error which evaluates the completeness and ability to reduce the added noise of the method, as mentioned in the paper titled “A complete ensemble empirical mode decomposition with adaptive noise”(doi:10.1109/ICASSP.2011.5947265)(The last paragraph of the third section and figure 5).
  4. Thus the ceemdan.get_imfs_and_residue() actually gets the final IMFs and the reconstruction error rather than the residue. And the ceemdan[-1] is the correct way to get the residue. Hope this can help you :).
ki-ljl commented 2 years ago

Thank you for your answer sincerely.