I want to run a clustering algorithm (svm, knn) on the ferquency spectrum data of a temperature sensor that published at irregular times. Here is the temperature data to take the FFT:
# group by short id groups = df.groupby('id') time_diff = groups.apply(lambda df: df.published_at.diff().mean())
Isolated the graphed temp data in a series:
signal = df.loc[df['_id'] == 'A1']['temperature']
Stored size of signal and mean sampling frequency as variables:
# sampling frequency: Fs = time_diff[:1] Fs Out: 00:18:54.085526 # size S = signal.size Then took the fft and calculated dBs X = np.fft.fft(signal) X_db = 20*np.log10(2*np.abs(X)/S) And plotted the results: plt.plot(X) plt.show()
These graphs intuitively do not look like they correspond to the original data. The objective with the fft is to then classify the data using SVM, however, I am not sure which variant fft is appropriate, nor if using the mean time frequency is either.