Title: Python SMOTE applied to extracted signals (arrays) of different size
Tags: python;audio;signal-processing;smote
Question: I'm unable to create new minority class instances to balance my data.
My signals have different sizes which I think is the problem.
I was aiming to try transformation in frequency domain to get a fixed array size and found out I got the same error I got from SMOTE:
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
TypeError: only size-1 arrays can be converted to Python scalars
The above exception was the direct cause of the following exception:
ValueError                                Traceback (most recent call last)
<ipython-input-318-0ab6c9eba330&gt; in <module&gt;
----&gt; 1 saved_data11 = fft(saved_data1)
C:\ProgramData\Anaconda3\lib\site-packages\scipy\fft\_backend.py in __ua_function__(method, args, kwargs)
21         if fn is None:
22             return NotImplemented
---&gt; 23         return fn(*args, **kwargs)
24
25
C:\ProgramData\Anaconda3\lib\site-packages\scipy\fft\_pocketfft\basic.py in c2c(forward, x, n, axis, norm, overwrite_x, workers, plan)
15         raise NotImplementedError('Passing a precomputed plan is not yet '
16                                   'supported by scipy.fft functions')
---&gt; 17     tmp = _asfarray(x)
18     overwrite_x = overwrite_x or _datacopied(tmp, x)
19     norm = _normalization(norm, forward)
C:\ProgramData\Anaconda3\lib\site-packages\scipy\fft\_pocketfft\helper.py in _asfarray(x)
90         return np.asarray(x, np.float32)
91     elif x.dtype.kind not in 'fc':
---&gt; 92         return np.asarray(x, np.float64)
93
94     # Require native byte order
C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\_asarray.py in asarray(a, dtype, order, like)
100         return _asarray_with_like(a, dtype=dtype, order=order, like=like)
101
--&gt; 102     return array(a, dtype, copy=False, order=order)
103
104
ValueError: setting an array element with a sequence.
I think the way I extracted the signals (appending signal to list) might be the reason for this problem but I am unable to find a fitting solution.
# pre-processing
signal = 0.90 * (signal/abs(max(signal)))
#remove silence
signal = svt.rms_silence_filter(signal, threshold=0.005)
# I am trying to save the signal after the pre-processing.
saved_data.append(np.array(signal))
saved_names.append(variable + '-'+ files[j])
print(count, end = ' ')
count += 1
Comment: make [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) please



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 0, 'CommentCount': 1, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2021:00:11/25/21', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<python><audio><signal-processing><smote>', 'Title': 'Python SMOTE applied to extracted signals (arrays) of different size', 'ViewCount': 59, 'id': 70114095, 'user_AboutMe': '', 'user_AccountId': 21254785.0, 'user_DisplayName': 'metanoia', 'user_Reputation': 11.0, 'user_Views': 4.0, 'user_id': 15636481.0}}