Using fourier analysis for time series prediction

后端 未结 4 1471
失恋的感觉
失恋的感觉 2021-01-29 22:02

For data that is known to have seasonal, or daily patterns I\'d like to use fourier analysis be used to make predictions. After running fft on time series data, I obtain coeffic

4条回答
  •  鱼传尺愫
    2021-01-29 22:45

    you can use the library that @tartakynov posted and, to not repeat exactly the same time series in the forcast (overfitting), you can add a new parameter to the function called n_param and fix a lower bound h for the amplitudes of the frequencies.

    def fourierExtrapolation(x, n_predict,n_param):
    

    usually you will find that, in a signal, there are some frequencies that have significantly higher amplitude than others, so, if you select this frequencies you will be able to isolate the periodic nature of the signal

    you can add this two lines who are determinated by certain number n_param

    h=np.sort(x_freqdom)[-n_param]
    x_freqdom=[ x_freqdom[i] if np.absolute(x_freqdom[i])>=h else 0 for i in range(len(x_freqdom)) ]
    

    just adding this you will be able to forecast nice and smooth

    another useful article about FFt: forecast FFt in R

提交回复
热议问题