Forecasting Techniques - Data Science SG

56

Click here to load reader

description

Presentation by Kai Xin on techniques learnt from Forecasting - Principles and Practice book: www.otexts.org/fpp Cover techniques like Seasonal and Trend decomposition using Loess (STL), Holts-Winters, ARIMA etc. R code adapted from the book is available at: https://github.com/thiakx/Forecasting_DSSG

Transcript of Forecasting Techniques - Data Science SG

Page 1: Forecasting Techniques - Data Science SG

Learnings from Forecasting - Principles and Practice

Page 2: Forecasting Techniques - Data Science SG

www.otexts.org/fpp

Page 3: Forecasting Techniques - Data Science SG

Basic Modeling

Intro & simple theory

ForecastingForecast+Model

www.otexts.org/fpp

Page 4: Forecasting Techniques - Data Science SG

Code at: https://github.com/thiakx/Forecasting_DSSG

Adapted from the Forecasting: Principles and Practice book

Page 5: Forecasting Techniques - Data Science SG
Page 6: Forecasting Techniques - Data Science SG

Judgmental Forecasts Machine Generated Forecasts

Page 7: Forecasting Techniques - Data Science SG

Judgmental Forecasts

The Basics

Page 8: Forecasting Techniques - Data Science SG

Judgmental Forecasts - Principles

Set the forecasting task clearly and concisely

Implement a systematic approach: -Document and justify

-Systematically evaluate forecasts

Segregate forecasters and users

Page 9: Forecasting Techniques - Data Science SG

Judgmental Forecasts - How to

Delphi Method - Panel of experts

Ask the executives, staff, customers

Use a proxy (similar cases, best / worst case)

Page 10: Forecasting Techniques - Data Science SG
Page 11: Forecasting Techniques - Data Science SG

Nate Silver

Page 12: Forecasting Techniques - Data Science SG
Page 13: Forecasting Techniques - Data Science SG
Page 14: Forecasting Techniques - Data Science SG
Page 15: Forecasting Techniques - Data Science SG

Machine Generated Forecasts

The Basics

Page 16: Forecasting Techniques - Data Science SG

The Basics - Time Series Decomposition

Page 17: Forecasting Techniques - Data Science SG

12 month seasonal

trend

The Basics - Seasonality

Page 18: Forecasting Techniques - Data Science SG

The Basics - Seasonality + Trend

Page 19: Forecasting Techniques - Data Science SG

The Basics - Remainder / Random Error

Page 20: Forecasting Techniques - Data Science SG

The Basics - Seasonal sub-series plot

Page 21: Forecasting Techniques - Data Science SG

The Basics

Page 22: Forecasting Techniques - Data Science SG

The Basics - Time Series Decomposition

then re-seasonalize with thisTrain model with this

Page 23: Forecasting Techniques - Data Science SG

The Basics - Time Series Decomposition

then re-seasonalize with thisTrain model with this

Page 24: Forecasting Techniques - Data Science SG

The Basics - Time Series Decomposition

95% confidence

80% confidence

then re-seasonalize with thisTrain model with this

Page 25: Forecasting Techniques - Data Science SG

The Basics - Time Series Decomposition

then re-seasonalize with thisTrain model with this

Page 26: Forecasting Techniques - Data Science SG

Seasonal and Trend decomposition using Loess (STL) code

Page 27: Forecasting Techniques - Data Science SG

Córdoba

Using seasonal-trend decomposition based on loess (STL) to explore temporal patterns of pneumonic lesions in finishing

pigs slaughtered in England, 2005–2011

Page 28: Forecasting Techniques - Data Science SG

Córdoba

Using seasonal-trend decomposition based on loess (STL) to explore temporal patterns of pneumonic lesions in finishing

pigs slaughtered in England, 2005–2011

STL is suitable as the overall trend fluctuates a fair bit

Page 29: Forecasting Techniques - Data Science SG

Machine Generated Forecasts

Time Series Forecasting: Exponential smoothing

Page 30: Forecasting Techniques - Data Science SG

Time Series Forecasts - Holts-Winters

Page 31: Forecasting Techniques - Data Science SG

Time Series Forecasts - Exponential Smoothing

Page 32: Forecasting Techniques - Data Science SG

Time Series Forecasts - Exponential Smoothing

More relevantLess relevant

Something to represent fall in relevance?

Page 33: Forecasting Techniques - Data Science SG

Time Series Forecasts - Exponential Smoothing

Smoothing Parameter α = 0.8 0.80.160.0320.064

T1T2T3T4

T1-T4

Page 34: Forecasting Techniques - Data Science SG

Time Series Forecasts - Exponential Smoothing

T1-T4

Smoothing Parameter α = decided by minimizing error rate

Page 35: Forecasting Techniques - Data Science SG

Time Series Forecasts - Damping

Undamped projection

Damped projection

Page 36: Forecasting Techniques - Data Science SG

Time Series Forecasts - Additive vs Multiplicative

The additive method is preferred when the

seasonal variations are roughly constant

through the series, while the multiplicative method is preferred when the seasonal

variations are changing proportional to the level of the series.

Page 37: Forecasting Techniques - Data Science SG

Time Series Forecasts - Holts-Winters

Page 38: Forecasting Techniques - Data Science SG

Link to: Usage of Modified Holt-Winters Method in the Anomaly Detection of Network Traffic: Case Studies

Page 39: Forecasting Techniques - Data Science SG

Link to: Usage of Modified Holt-Winters Method in the Anomaly Detection of Network Traffic: Case Studies

Holt-Winter is suitable as the most recent behavior that deviates from norm is worth a lot more than past behavior

Page 40: Forecasting Techniques - Data Science SG

Machine Generated Forecasts

Time Series Forecasting: ARIMA Models

(AutoRegressive Integrated Moving Average)

Page 41: Forecasting Techniques - Data Science SG

Time Series Forecasts - ARIMA with Drift

ARIMA(3,1,1)(0,1,1)[12] with drift

Page 42: Forecasting Techniques - Data Science SG

Time Series Forecasts - ARIMA with Drift

ARIMA(3,1,1)(0,1,1)[12] with drift

Allow forecasts to change over time

Number of periods per season.

} }Non-

Seasonal Part

Seasonal Part

Page 43: Forecasting Techniques - Data Science SG

Time Series Forecasts - ARIMA with Drift

ARIMA(3,1,1)(0,1,1)[12] with drift

Allow forecasts to change over time

Number of periods per season.

p = order of the autoregressive part; d = degree of first differencing involved;

q = order of the moving average part.} }

Non- Seasonal

Part

Seasonal Part

}(p,d,q) }(p,d,q)

Page 44: Forecasting Techniques - Data Science SG

Time Series Forecasts - Auto Regression

In a multiple regression model, we forecast the variable of interest using a linear combination of predictors.

!vs !

In an autoregression model, we forecast the variable of interest using a linear combination of past values of the variable

(regression of the variable against itself)

Page 45: Forecasting Techniques - Data Science SG

Time Series Forecasts - Auto Regression

In a multiple regression model, we forecast the variable of interest using a linear combination of predictors.

!vs !

In an autoregression model, we forecast the variable of interest using a linear combination of past values of the variable

(regression of the variable against itself)

Order = no. of past values

Page 46: Forecasting Techniques - Data Science SG

Time Series Forecasts - Differencing

What we doing in (b) is differencing by computing the differences between consecutive observations.

The goal is to eliminate trend and seasonality.

(a) Dow Jones index (b) Daily change in Dow Jones index

Page 47: Forecasting Techniques - Data Science SG

Time Series Forecasts - Differencing

What we doing in (b) is differencing by computing the differences between consecutive observations.

(a) Dow Jones index (b) Daily change in Dow Jones index

Order = no. of difference needed

Page 48: Forecasting Techniques - Data Science SG

Time Series Forecasts - Moving Average

Rather than use past values of the forecast variable in a regression, a moving average model uses past forecast errors in a regression-like model (a weighted moving average of the past few forecast errors).

Page 49: Forecasting Techniques - Data Science SG

Time Series Forecasts - Moving Average

Rather than use past values of the forecast variable in a regression, a moving average model uses past forecast errors in a regression-like model (a weighted moving average of the past few forecast errors).

Order = no. of past values

Page 50: Forecasting Techniques - Data Science SG

Time Series Forecasts - ARIMA with Drift

ARIMA(3,1,1)(0,1,1)[12] with drift

Page 51: Forecasting Techniques - Data Science SG

Link to Seasonal ARIMA for Forecasting Air Pollution Index: A Case Study (Johor Malaysia)

Page 52: Forecasting Techniques - Data Science SG

Link to Seasonal ARIMA for Forecasting Air Pollution Index: A Case Study (Johor Malaysia)

ARIMA is one of the most popular time series forecasting methods. It is very flexible and can handle complex scenarios

Page 53: Forecasting Techniques - Data Science SG

Time Series Forecasts - Comparison of Accuracy

Page 54: Forecasting Techniques - Data Science SG

Time Series Forecasts - Comparison of Accuracy

Page 55: Forecasting Techniques - Data Science SG
Page 56: Forecasting Techniques - Data Science SG

Kudos to the awesome designers on thenounproject.com

Folder by Christina W

Checklist by João Marcelo Ribeiro

Fence by José Hernandez

Robot by Simon Child

Conference by Wilson JosephMeeting by Olivier Guin

Employee Evaluation by Miroslav KošaPeople by iconoci

STLARIMA

Holt-Winters