Using fourier analysis for time series prediction

后端 未结 4 1480
失恋的感觉
失恋的感觉 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:49

    It sounds like you want a combination of extrapolation and denoising.

    You say you want to repeat the observed data over multiple periods. Well, then just repeat the observed data. No need for Fourier analysis.

    But you also want to find "patterns". I assume that means finding the dominant frequency components in the observed data. Then yes, take the Fourier transform, preserve the largest coefficients, and eliminate the rest.

    X = scipy.fft(x)
    Y = scipy.zeros(len(X))
    Y[important frequencies] = X[important frequencies]
    

    As for periodic repetition: Let z = [x, x], i.e., two periods of the signal x. Then Z[2k] = X[k] for all k in {0, 1, ..., N-1}, and zeros otherwise.

    Z = scipy.zeros(2*len(X))
    Z[::2] = X
    

提交回复
热议问题