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:
I got the mean frequency for this temperature data as well as every temp sensor in the dataframe the average is every 18mins, longest distance between 2 points is 3hrs:
# 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[217]: 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()
plt.plot(X_db)
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.