TSF - Week 2 - MLS0.2
TSF - Week 2 - MLS0.2
Forecasting
(Forecasting)
Week-2
Domain
Foundations Core Courses
Applications
2. Naïve Forecast
3. SES(Simple Exponential
Smoothing) If the time series
neither has a pronounced trend
nor seasonality but has an
average value for a specific
time period.
4. DES(Double Exponential
Smoothing) Applicable when
time series data has a trend but
no seasonality
5. TES(Triple Exponential
Smoothing ) Applicable when
Proprietary content. ©Great Learning. All Rights Reserved. Una
time series data has a trenduthorized
anduse or distribution prohibited.
Ways to forecast
Based on past data one will use algorithms/models to predict the future
• Few simple methods to consider forecasting
1) Naïve forecast
2) Simple Average
3) Moving average
4) Linear Regression
5) Simple exponential smoothing
6) Double exponential smoothing (Holt’s model)
7) Triple exponential smoothing (Holt’s winter model)
Steps in forecasting
• This session
• Preparation of data
• Forecast using models
• Model evaluation
Preparation of data
Train dataset
Latest data
Old data
Test dataset
• Performance of forecast method is tested by comparing the forecast values with actual test data
• Perform various model evaluation between actual (test data) and forecasted values(fitted values) through
various methods
Model evaluation : How to judge a
model?
Error = Actual– Forecast
• The model is selected to be the best where actual and forecasted values are the closest or the error is
low
Technique Abbreviation Forecast Error
ݐ
Forecast
Error/Bias/ ME ͳ
ߑ ܻ ݐെܻ
Mean Error ܶ
ଶ
ݐ
Mean Squared ͳ
MSE ߑ ܻ ݐെ ܻ
Error ܶ
Root Mean
RMSE
Square Error
ݐ
Mean Absolute ͳ
MAD ߑ ܻ ݐെܻ
Deviation ܶ Where :
Y(t)- Actual
ݐ
Mean Absolute - Forecast
MAPE ͳ ܻ ݐെ ܻ
Percent Error ߑ ൈͳͲͲ T - # of Observations
ܶ ܻݐ
Method 1: Naïve forecast
Naïve Forecast Squared Sqaure Absolute Percent
Month Volume
Forecast Error Error root Error Error
Janaury 10 # NA
Naive forecasting places
February 12 10 2 4 2 2 16.67%
March 16 12 4 16 4 4 25.00% 100% weight on the
April 13 16 -3 9 3 3 23.08% most recent
May 17 13 4 16 4 4 23.53% observation
June 19 17 2 4 2 2 10.53%
July 15 19 -4 16 4 4 26.67%
It’s the most simple
August 20 15 5 25 5 5 25.00%
September 22 20 2 4 2 2 9.09% way of forecasting
October 19 22 -3 9 3 3 15.79%
November 21 19 2 4 2 2 9.52%
December 19 21 -2 4 2 2 10.53%
Forecast
0.818 RMSE 3.177 MAD 3.00
Error
MSE 10.09 MAPE 17.76%
Method 1a: Naïve forecast
Forecast
-2.083 RMSE 4.173 MAD 3.08
Error
MSE 17.42 MAPE 23.32%
Method 2: Average Forecast
Forecast
0.000 RMSE 3.616 MAD 3.10
Average 203 16.92 Error
12 MSE 13.08 MAPE 20.84%
Method 3: Moving average/Rolling average
Volume
June 19 27.89 -8.89 78.97 8.89 8.89 47% 10
July 15 24.38 -9.38 87.91 9.38 9.38 63%
5
August 20 28.76 -8.76 76.81 8.76 8.76 44%
September 22 30.52 -8.52 72.58 8.52 8.52 39% 0
0 2 4 6 8 10 12 14
October 19 27.89 -8.89 78.97 8.89 8.89 47%
Month
November 21 29.64 -8.64 74.68 8.64 8.64 41%
December 19 27.89 -8.89 78.97 8.89 8.89 47%
Forecast
-9.141 RMSE 9.152 MAD 9.14
Error
MSE 83.76 MAPE 57.76%
Forecast is done based on the relationship between the dependent and independent
variable
Exponential Smoothing
• Weights are added on the observations. Weights decay as observations get older
• Practically speaking, only the recent observations matter
• Alpha (α) acts as a parameter to control how fast the weights decay
Simple Exponential Smoothing(SES)
• If the time series does neither have a pronounced trend nor seasonality: Almost non-available! OR data with no trend or seasonal pattern
Why Exponential?
Y (t+1) = αY(t)+α (1-α)Y(t-1)
Forecast
5.172 RMSE 5.610 MAD
Error
MSE 31.47 MAPE 28.44%
Double Exponential
Smoothing(DES)
• Applicable when data has Trend but no seasonality
• An extension of SES
• Two separate components are considered: Level and Trend
• Level is the local mean
• One smoothing parameter α corresponds to the level series
• A second smoothing parameter β corresponds to the trend series
• Also known as Holt model
Holts method
• The k-step-ahead forecast is given by combining the level estimate at time t (Lt) and the trend estimate at
time t (Tt).
where α, β, and γ are the three smoothing parameters to deal with the level pattern,
the trend, and the seasonality, respectively.
Level data Data with level & trend Data with level, trend &
• Moving average • Holts method (α, β) seasonality
• Simple exponential • Holt winters (α, β, )
smoothing (α)
27
Industry Application – Predicting
Government Spending
• Get noticed by your management with your outstanding analysis backed by data
science.
• Network with members from the data science vertical of your organization and seek
opportunities to contribute in small projects.
• Share your success stories with us and the world to position yourself as a subject matter expert
in data science.