Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
107 views

Excel and Forecasting Lab

The document discusses various techniques for forecasting supply chain demand, including moving average models, exponential smoothing models, and statistical forecasting in Excel and Python. It emphasizes that both coding skills and a scientific mindset are needed for data science. Key aspects covered include calculating forecast error using metrics like MAPE, MAE, and RMSE to evaluate model accuracy. Moving average models are demonstrated for forecasting, including creating the models in Excel and Python.

Uploaded by

mehak rajdev
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
107 views

Excel and Forecasting Lab

The document discusses various techniques for forecasting supply chain demand, including moving average models, exponential smoothing models, and statistical forecasting in Excel and Python. It emphasizes that both coding skills and a scientific mindset are needed for data science. Key aspects covered include calculating forecast error using metrics like MAPE, MAE, and RMSE to evaluate model accuracy. Moving average models are demonstrated for forecasting, including creating the models in Excel and Python.

Uploaded by

mehak rajdev
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

Forecasting

Using Excel and Python


Data Analysis and Supply Chain Forecast
• AI and ML are not just a question of coding skills
• You need a scientific mindset as well
• Need the right tools and a scientific mindset
• Yesterday Vs Today

Data Science for Supply Chain Forecast by Nicholas Vandeput


Data Scientist Mindset
• Data is gold
• Start small, iterate
• Experiment
• Automation is the key to fast experimentation
• Don’t get misled by overfitting and luck
• Sharing is caring
• Simplicity over complexity
• Focus on the point

Data Science for Supply Chain Forecast by Nicholas Vandeput


Data Scientists Toolsets
• Excel
• Python

Data Science for Supply Chain Forecast by Nicholas Vandeput


Supply Chain Forecast
• All supply chains involve planning
• The better the planning (evaluate future) the better we can prepare
ourselves
• Future is uncertain
• How to reduce the uncertainty is very crucial for any supply chain
planning
• “What is tomorrow going to be like?”

Data Science for Supply Chain Forecast by Nicholas Vandeput


Statistical Forecast Models
• Moving average
• Exponential smoothing
• Double exponential smoothing
• Triple exponential smoothing
• Triple additive exponential smoothing

Data Science for Supply Chain Forecast by Nicholas Vandeput


Moving Average
• It is one of the simplest forecasting model
• It is based on the idea that future demand is similar to the recent demand
we observed
• Forecast is the average of the demand during the last n periods
• e.g. forecast for June will be the average of March, April, and May
n
• Model f t 
1
 dt i
n i 1

• n is the number of periods we take the average of


• dt is the demand we observed during the periods t.
• ft is the forecast we made for period t

Data Science for Supply Chain Forecast by Nicholas Vandeput


Moving Average
• Demand will be denoted as d
• Forecast will be noted as f
• Initialization
• For the MA method we won’t have a forecast until we have enough historical
demand observations.
• First forecast will be done for t=n+1
• Future forecast
• Once we are out of the historical period, any future forecast will be the last
one that was done based on the historical demand
• What is the drawback of this?

Data Science for Supply Chain Forecast by Nicholas Vandeput


Create a Moving Average Model
• Based on the last 3 demand occurrences (n=3)
• Create 3 columns
• Date ( 1 to 10 as numbers)
• Demand (37, 60, 85 , 112 , 132 , 145, 179, 198, 212, 232)
• Forecast (?)
• Define the first forecast on date 4.
• Use the Average formula and use this formula till date 11 (which will be the
last forecast based on historical demand)
• What will be the forecast for date 12 and date 13 and so on?
• Draw the Moving Average Chart

Data Science for Supply Chain Forecast by Nicholas Vandeput


Python Refresh
• Lists
• An ordered sequence of any number of objects
• Can’t do number computation
• NumPy
• NumPy array similar to list
• Can do number computation
• Most of the NumPy functions can be used on a list
• Slicing
• To select a particular value in a list or an array
• Use index of the location
• What is the catch?
• Pandas
• One of the most used libraries in Python
• Dataframe object which is very similar to an Excel Table

Data Science for Supply Chain Forecast by Nicholas Vandeput


Python Refresh: Slicing DataFrames

• Many different ways to slice a dataframe


• Select a specific column by passing the name of the column directly to the
dataframe
• df[“myColumn”]
• df.myColumn
• Select a row based on its index value
• df[myIndexValue]
• Select an element based on its row and column
• df.loc[myIndexValue, “myColumn”]
• Use the same slicing method as for lists and arrays
• df.iloc[2,3]
• We will use dataframe to store demand and forecast

Data Science for Supply Chain Forecast by Nicholas Vandeput


Python Refresh: Dictionaries
• Dictionary is like a list where each element has a unique name
• Create one by including between {} a key and a value where the key
must be a string and the value can be anything
• Create dataframes directly from dictionaries
• Use the from_dict function

Data Science for Supply Chain Forecast by Nicholas Vandeput


Create a Moving Average Function in Python
• The function moving_average takes 3 inputs:
• d: a time series that contains the historical demand
• extra_periods: the number of periods we want to forecast in the future
• n: the number of periods we will average

• Use np.nan and np.full(shape, value) functions


• Moving average model does not see a trend and there

Data Science for Supply Chain Forecast by Nicholas Vandeput


Use Jupyter Notebook/Lab

Data Science for Supply Chain Forecast by Nicholas Vandeput


Forecast Error
• How accurate is the model?
• Calculate the forecast accuracy or error
• There is no one-size-fits-all approach/indicator
• A forecast should be precise and unbiased
• Error

• If the forecast overshoots the demand, the error will be positive


• if the forecast undershoots the demand, then the error will be negative.
Data Science for Supply Chain Forecast by Nicholas Vandeput
Forecast Precision Vs Bias
• Precision
• Measures how much spread you have
between the forecast and the actual
value
• Provides an idea of the magnitude of
the error but not the overall direction
• Bias
• Represents the historical average error
(will the forecast be too high or too
low)
• Provides an overall direction of the
error

Data Science for Supply Chain Forecast by Nicholas Vandeput


Forecast KPI (Key Performance Indicator)
• MAPE (Mean Absolute Percentage Error)
• MAE (Mean Absolute Error)
• RMSE (Root Mean Square Error)

Data Science for Supply Chain Forecast by Nicholas Vandeput


Bias
• The bias is defined as the average error

• n is the number of historical periods

• A positive error on one item can offset a negative error on another item
• A forecast model can achieve a very low bias and not be precise at the
same time.
• The bias alone won't be enough to evaluate your forecast precision.
• A highly biased forecast is already an indication that something is wrong in
the model.
Data Science for Supply Chain Forecast by Nicholas Vandeput
MAPE
• The Mean Absolute Percentage Error (MAPE) is one of the most
commonly used KPIs to measure forecast accuracy.
• MAPE is the sum of the individual absolute errors divided by the
demand (each period separately).
• It is the average of the percentage errors.
• It is a well-known indicator among business managers, despite being
a really poor-accuracy indicator.
• MAPE divides each error individually by the demand, so it is skewed
• High errors during low-demand periods will have a major impact on MAPE

Data Science for Supply Chain Forecast by Nicholas Vandeput


MAE
• The Mean Absolute Error (MAE) is a very good KPI to measure
forecast accuracy.
• It is the mean of the absolute error.

• One of the issues of this KPI is that it is not scaled to the average
demand.
• To solve this, it is common to divide MAE by the average demand to
get a %:

Data Science for Supply Chain Forecast by Nicholas Vandeput


RMSE
• It is defined as the square root of the average squared error.

• Just as for MAE, RMSE is not scaled to the demand. We can then
define RMSE% as

Data Science for Supply Chain Forecast by Nicholas Vandeput


RMSE Vs MSE
• Many ML algorithms are based on the Mean Squared Error (MSE), which is
directly related to RMSE

• MSE is used by many algorithms as it is faster to compute and easier to


manipulate than RMSE.
• But it is not scaled to the original error (as the error is squared), resulting in
a KPI that we cannot really relate to the original demand scale.
• Therefore, we won't use it to evaluate our statistical forecast models

Data Science for Supply Chain Forecast by Nicholas Vandeput

You might also like