Professional Documents
Culture Documents
Week 3 - Demand Forecasting by Artificial Neural Networks
Week 3 - Demand Forecasting by Artificial Neural Networks
2020
Demand Forecasting by
Artificial Neural
Network (ANN)s
1
2.11.2020
What is ANN?
An ANN, inspired from human brain, is a numerical model developed in a similar way with the
nature of the biological nervous system.
Although there are different aspects of the various ANN models, the main characteristics of
ANN are non-linearity, learning, and flexibility.
There are multilayer (MLP-multi-layer perceptron) as well as single layer ANN models.
Input-output variables’ relations are non-linear and this non-linearity can be represented by the
ANN model and this allows complex problems to be solved.
Learning is the ability to make inferences from data, inspired by the human brain. Hence, ANN
can stand out from the classical algorithms.
ANN can easily adapt to the changes that may occur in the models, therefore it is flexible.
2
2.11.2020
Neuron
Biological Neurons are the fundamental units of the brain and nervous system.
These cells receive sensory input from the external world via dendrites, process it and gives the
output through Axons.
https://towardsdatascience.com/introduction-to-artificial-neural-networks-ann-1aea15775ef9
Perceptron
A single layer neural network is called a
Perceptron that gives a single output.
Each of the inputs multiplied by a connection
weight or synapse.
Weight shows the strength of a specific node.
σ 𝑥𝑘 𝑤𝑘 𝑖𝑠 𝑐𝑜𝑚𝑝𝑢𝑡𝑒𝑑.
Then, Activation function is applied:
𝑓 σ 𝑥𝑘 𝑤𝑘 .
Activation function decides whether a neuron
should be activated or not by calculating the
weighted sum and further adding bias to it.
The motive is to introduce non-linearity into
the output of a neuron.
(Wikipedia)
PREPARED BY DR. SULE ITIR SATOGLU 6
3
2.11.2020
Example
Price of a house may be afffected by its
Area footage area, # of bedrooms, distance to the
X1 w1
city center, and age of the house.
# of bedrooms
X2 Price
w2
Distance to
y
city center w3
X3
w4
Age
X4
Multi-Layer Perceptron
ANNs may have hidden layer(s), thus hidden
neurons.
So, this is a multi-layer perceptron.
(Kubat, 2017)
4
2.11.2020
Example
Not all synapses are
Area weighted.
X1 w1 Synapses with zero
# of bedrooms Price weight not shown here.
X2 w2 y Positive weight:
Distance to
city center w3 Importance of the
X3
neuron.
w4
Zero weight: Discard the
Age
connecton/synapse.
X4
Hidden layer
5
2.11.2020
Back-Propagation
Back-propagation is a widely used algorithm in training feedforward neural
networks for supervised learning.
While fitting an ANN, backpropagation computes the gradient of the loss/cost
function with respect to the weights of the network for a single input–output
example, and does so efficiently.
This efficiency makes it feasible to use gradient methods for training multilayer
networks, updating weights to minimize loss/cost.
6
2.11.2020
Stages
7
2.11.2020
Feature Selection
Scaling the data by means of Normalization.
Normalization is needed, because the scales of the input variables are often different from
each other!
Alternative Normalization methods can be applied.
Min-max Normalization is applied as follows:
𝑥−𝑥𝑚𝑖𝑛
𝑥𝑛𝑒𝑤 = Hence, the independent variables values’ range between 0 and 1.
𝑥𝑚𝑎𝑥 −𝑥𝑚𝑖𝑛
Raw data may contain some features with little/no predictive value.
Identify and exclude irrelevant ones.
Sometimes creating synthetic features out of two or more raw features can be helpful.
8
2.11.2020
Feature Selection
Categorical variables: These show the specific and categorical
aspects of the entities (stores, products etc).
Ordinal variables: A scale from low to high (such as 1 to 5) is given to
the values of the variables.
Continous variables: Those can take any value and these are
quantifiable.
One-Hot Encoding
Categorical variables take N-possible values.
So, a feature has N-possible values.
It is useful to encode such kind of a feature with N-values as N-features, each taking a binary
value.
In Phyton: Some functions in Scikit-learn will transform raw datasets into this format.
Dimensionality is increased.
Ex.: We have stores named Istinyepark, Kanyon, etc. So we define new features for each of them.
https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html
Sklearn.preprocessing.LabelBinarizer --> This function converts categorical variables’ each value
into a feature.
9
2.11.2020
Decide Hyperparameters
Hyperparameters control the flow of the training or tune the training.
Hidden number of neurons, etc.
Scikit-learn models have hypreparameters set before they are trained.
These are sensible-defaults.
You can change if you want.
10
2.11.2020
Train/Test Split
The data must be properly split into traininng dataset and test dataset groups.
In Phyton the function:
Train_test_split(X,y,..) exist.
This function intends to prevent over-fitting problem.
Overfitting problem: Overfitting happens when a model learns the detail and noise in the
training data to the extent that it negatively impacts the performance of the model on new data.
In other words, the algorithm memorizes the data, and cannot predict well when a different or
unseen type of data appears.
So, the training and test data must be evenly split into parts to prevent overfitting problem.
11
2.11.2020
Coefficeint of Correlation/Determination
R2: Square of Coefficent of Correlation
This is not an error measure, but shows how well the variance of
dependent variable (values) are explained by the independent variables.
ANN results frequently show R2 for assessing the forecasting performance.
12
2.11.2020
Motivation
Especially, in retail and apparel industries, products are not tailor-made and must be
produced and made available in chain stores for the customers, in advance.
Large variety of products, diversity in customer expectations and changes in trends make
forecasting very difficult for the retail products. (Ren et al., 2019)(Beheshti-Kashi et al., 2015)
Demand is not stable, especially in big data era (Ren et al., 2019) and fashion supply chain is
primarily based on quick and competent forecast (Ren et al., 2017).
Poor forecasting cause stock outs and insufficient usage of resources.
So, an ANN model needs to be developed for the apparel retail chain stores.
Purpose
Purpose of this study is to develop an ANN to forecast sales of a product family sold in
an apparel chain store.
The past sales, sales price, promotion data of selected stores, as well as store type and
location information and weather temperature data are included in the ANN models.
The city with the highest number of stores was selected and 37 of the stores in this city
were chosen and considered.
Besides, Regression Analysis was used for forecasting.
The results obtained by the ANN was much better than those of the Regression
Analysis.
13
2.11.2020
Methodology
Application
There are shopping mall stores and and Street stores of the retail chain store in Istanbul.
Firstly, the data set that belongs to the sales of sports shoes model in the stores at the shopping
centers in Istanbul was used.
Street stores are not considered because they may vary in product models and prices.
Secondly, the stores and concept stores were also considered for both shopping malls and street
stores.
The models for these two different prediction models are defined as modelstores and modelgeneral,
respectively.
An artificial neural network model (ANN) has been proposed to estimate the sales of the model
that can be used in all seasons.
The weekly sales data for 2014-2017 used in the ANN model.
14
2.11.2020
15
2.11.2020
Application-Model Development
The ANN structure of modelstores is presented in the Figure.
At this stage, many network designs were established and
networks trained and results were obtained.
At the end of experiments, the best learning model with
the least error value was accepted.
Bayesian regulation learning function and feed-forward
back propagation algorithm are applied.
The network structure includes two layers, twenty hidden
neurons, sigmoid activation and tansig transfer functions.
Many trials were made to find the best ANN configuration.
16
2.11.2020
Results
Results
17
2.11.2020
18
2.11.2020
19