two algorithms for time series forecasting · decomposition is a powerful tool in time series...

39
Two Algorithms for Time Series Forecasting Danny Yuan

Upload: others

Post on 31-Jul-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

Two Algorithms for Time Series Forecasting

Danny Yuan

Page 2: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

Forecasting with Fast Fourier Transformation

Page 3: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

Key Idea: Decomposition

Page 4: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem
Page 5: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

A reasonably continuous and periodic function can be expressed as the sum of a series of sine terms

Page 6: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem
Page 7: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem
Page 8: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem
Page 9: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem
Page 10: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem
Page 11: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem
Page 12: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem
Page 13: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

1. Run FFT on input data

2. Filter out low-amplitude, high-frequency components

3. Forecast on each individual component

4. Run inverse of FFT of filtered data

5. Profit!

FFT Is Simple

Page 14: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

FFT Is Simple

Page 15: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem
Page 16: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem
Page 17: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

Solution: Iteratively Compensate Input with Error

Page 18: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem
Page 19: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem
Page 20: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem
Page 21: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

When Should We Use FFT?

Page 22: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

When There Is Periodicity

Page 23: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

When You Need a Quick Job

Page 24: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

Decomposition Is Powerful

Reference

Page 25: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

Decomposition Is Powerful

Page 26: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

Decomposition Is Powerful

Page 27: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

Decomposition Is Powerful

Page 28: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

Where Is The Bottleneck?

● Not easy to combine new signals

● E.g. events, weather

Page 29: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

Forecasting With Deep Learning

Page 30: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem
Page 31: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem
Page 32: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

● Time series can be discretized into sequence

● We can apply techniques of seq2seq

Key Idea: Time Series Are Sequences

Page 33: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

t

H_1

Input1

H_2

Input2

H_3

Input3

H_n

Inputn-1

H_0

Start

Forecast1

Forecast2

Forecast3

Forecast4

Forecastn

T0 T1 T2 T3 Tn

Page 34: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

t

H_1

Input1

H_2

Input2

H_3

Input3

H_n

Inputn-1

H_0

Start

Forecast1

Forecast2

Forecast3

Forecast4

Forecastn

[Forecast 1, Time of Week 1]…...

[F_(n-1), TOW_(n-1)]

Page 35: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

t

H_1

Input1

H_2

Input2

H_3

Input3

H_n

Inputn-1

H_0

Start

Forecast1

Forecast2

Forecast3

Forecast4

Forecastn

…...

[F_(n-1), TOW_(n-1), Weather_(n-1), X_(n-1)][Forecast 1, Time of Week 1,

Weather 1][Temperature, Humidity, Precipitation, Wind, Weather Type]

Page 36: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

What About Recent Context?

Page 37: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

tt - 1t - m + 2t - m + 1t - m [F_1, TOW_1, Weather_1, X_1] …... [F_(n-1), TOW_(n-1), Weather_(n-1), X_(n-1)]

h_1

Input1

h_2

Input2

h_3

Input3

h_m

Inputm

H_1

Input1

H_2

Input2

H_3

Input3

H_n

Inputn-1

H_0

Start

Forecast1

Forecast2

Forecast3

Forecast4

Forecastn

Page 38: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

tt - 1t - m + 2t - m + 1t - m [F_1, TOW_1, Weather_1, X_1] …... [F_(n-1), TOW_(n-1), Weather_(n-1), X_(n-1)]

h_1

Input1

h_2

Input2

h_3

Input3

h_m

Inputm

H_1

Input1

H_2

Input2

H_3

Input3

H_n

Inputn-1

H_0

Start

Forecast1

Forecast2

Forecast3

Forecast4

Forecastn

Encoder Decoder

Page 39: Two Algorithms for Time Series Forecasting · Decomposition is a powerful tool in time series forecasting Time series forecasting can be modeled as a seq2seq problem

Summary

● Decomposition is a powerful tool in time series forecasting

● Time series forecasting can be modeled as a seq2seq problem