I would like to use FastFourierTransformation in order to identify patterns so as to predict future values of my monitoring metrics. What I'm trying to do is:
I monitor incoming traffic load, which is being repeated seasonally (high picks during daytime), with an additionally trend over a period of a week (lower traffic during weekends, also seasonally repeated).
Although I've tried some augmented regression algorithms, but I would also like to use the FFT in order to identify the most important coefficients, so as to recognize these two most important frequencies, and then try to extrapolate so as to predict the traffic in the near future.
I'm struggling with apache.commons.math3.transform.FastFourierTransformation
, although my theoretical background in mathematics causes me some troubles.
Supposing that I use a doube [] array
for storing my latest traffic load in the observed timeframe, I use the following code:
double [] initialSignal = getMonitoringData(timeslide);
FastFourierTransformer fft = new FastFourierTransformer(DftNormalization.STANDARD);
Complex [] result = fft.transform(initialSignal, TransformType.FORWARD);
However I'm not familiar with what the Complex []
array represents. Does the imaginary attribute of each Complex object in the array represents the relevant sinusoidal coefficient?
So, if I want to take the denoised initial signal I only have to set to zero the less significant coefficients of the Complex [] result array?
But still, if I have the following
Complex [] denoised = fft.transform(importantCoefficiants, TransformType.INVERSE);
The result will still be an array of Complex. How can i get the newly transformed x(t) values of the time series?
And how can I extrapolate in order to predict the x(t+1), x(t+2) ... x(t+n) values
, after denoising the initial time series?
Well, I guess I found a solution yesterday night, pretty similar with erickson's answer. I calculate the x^2+y^2 and then I take into account the most significant coefficients. I'm setting to zero the other elements of the array and then I perform a IFFT. My final question now is:
How I can extrapolate the given result in the Complex array so as to predict future values? For instance, if I have n=4096 samples (Complex [4096] array) as my input, then I suppose that the value of x(n+1) will be the value of the array[0], the value of x(n+2) will be the value of array[1] etc?