Description
When using PySDKit.VMD on a relatively long time series, the VMD implementation attempts to allocate a very large amount of memory and raises a numpy.core._exceptions._ArrayMemoryError.
The main source of the memory usage seems to be this allocation in pysdkit/_vmd/vmd_c.py:
u_hat_plus = np.zeros(
[self.max_iter, len(freqs), self.K],
dtype=complex
)
This stores the frequency-domain modes for all iterations.
For long signals, the memory requirement becomes very large because its complexity is approximately:
O(max_iter * signal_length * K)
Example
For my data:
Original signal length: ~265,140
Mirrored signal length / len(freqs): 530,280
max_iter: 500
K: 8
dtype: complex128
PySDKit tries to allocate:
shape = (500, 530280, 8)
which requires about:
31.6 GiB
Full traceback:
File ".../pysdkit/_vmd/vmd_c.py", line 186, in fit_transform
u_hat_plus = np.zeros([self.max_iter, len(freqs), self.K], dtype=complex)
numpy.core._exceptions._ArrayMemoryError:
Unable to allocate 31.6 GiB for an array with shape
(500, 530280, 8) and data type complex128
Description
When using
PySDKit.VMDon a relatively long time series, the VMD implementation attempts to allocate a very large amount of memory and raises anumpy.core._exceptions._ArrayMemoryError.The main source of the memory usage seems to be this allocation in
pysdkit/_vmd/vmd_c.py: