Lecture 7 - ANN
Lecture 7 - ANN
n Outline:
1. Overview of ANN
2. Components of ANN
4. ANN characteristics
5. ANN design
Artificial Neural Network (ANN)
n Outline:
1. Overview of ANN
2. Components of ANN
4. ANN characteristics
5. ANN design
What is an ANN?
Input Weights
x1
x2 u Output
y = f (u)
x3 y
y
.
N
xN u = ∑ x jw j
j=1
u
Perceptron neuron model
Ø Add bias
N
Input Weights u = ∑ x jw j +θ
j=1
x1
x2 Output
u
f(u) y
x3
. ⎧⎪ 1 u ≥ 0
y=⎨
xN b= θ ⎪⎩ 0 u < 0
Artificial Neural Network (ANN)
n Outline:
1. Overview of ANN
2. Components of ANN
4. ANN characteristics
5. ANN design
Input Weights Cell
x1 body
x2 u Output
f(u)
x3 y
.
xN
General neuron model
x1 Net function
Output
x2 u N
f(u) u = ∑ x jw j +θ
x3 y j=1
.
xN Activation function
y = f (u)
θ Ex: 1
{wj; 1 £ j £ N}: synaptic weights y = f (u) =
1+ e −u
q : threshold
Popular net functions
Popular activation functions
Multilayer perceptron model (MLP)
Fully
connected
Artificial Neural Network (ANN)
n Outline:
1. Overview of ANN
2. Components of ANN
4. ANN characteristics
5. ANN design
ANN training process?
§ Forward propagation:
§ Backward propagation:
0 0.21
0 0.156
1 0.78
1 0.83
ANN training example – epoch 2
0 0.194
0 0.143
1 0.802
1 0.895
ANN training example – epoch n
0 0.119
0 0.056
1 0.884
1 0.926
Error back propagation learning
§ Step 1: initialization
W – weight
E – error
Learning rate choosing
Stopping conditions
n Outline:
1. Overview of ANN
2. Components of ANN
4. ANN characteristics
5. ANN design
ANN characteristics
§ Parameters, hyperparameters
§ Underfitting, overfitting
§ Generalization
ANN parameters
Ø Weights
Ø Biases
Ø Learning rate
Ø Net function
Ø Activation function,
§ Shallow NN:
§ Deep NN:
Good generalization
Model fitting
(cont) Good model Overfitting
Ø More layers
Ø Feature engineering
Ø Feature selection
How to avoid overfitting? (cont)
§ Enlarge data
Ø Data cleaning
§ More regularization
Ø Early stopping
Ø Drop out
Ø L1, L2 regularization
Early stopping
Generalization
§ Good generalization: the I/O mapping is nearly correct for new data
Good
generalization
Generalization
Ø ANN architecture
Ø Problem complexity
n Outline:
1. Overview of ANN
2. Components of ANN
4. ANN characteristics
5. ANN design
ANN design process
§ Training
§ Training
One-hot encoding
⎧ 1, x ∈ C ⎡ ⎤
⎪ j k ⎢ 0 ⎥
dk , j =⎨ ⎢ ! ⎥
⎪⎩ 0, x j ∉ Ck ⎢ 1 ⎥ ← kth element
⎢ ⎥
⎢ ! ⎥
⎢ 0 ⎥
⎣ ⎦
Ck − class k
x j − input j
d k , j − desired output
ANN design process
§ Training
§ Feed forward neural network: may or may not have the hidden
layers (one or multiple hidden layers)
§ Training
§ Learning rate
§ Activation function
§ Net function
§ Data preprocessing
§ Training
§ Heuristics:
§ Training
§ Training
§ Hold out
§ LOOCV
Performance
https://www.youtube.com/watch?v=VyWAvY2CF9c
§ Sinh viên làm bài tập theo nhóm đã phân công cho học phần, bao
gồm các bước sau:
Ø Huấn luyện và kiểm tra mô hình ANN (số neuron lớp ẩn lần lượt là
10, 15), dùng đặc trưng Hu’s moments, tốc độ học là 𝜂 = 0.1.
Đánh giá mô hình ANN bằng phương pháp 5-fold cross validation.
Nhận xét kết quả.
§ Sinh viên làm bài tập theo nhóm đã phân công cho học phần, bao
gồm các bước sau:
Ø Huấn luyện và kiểm tra mô hình ANN (số neuron lớp ẩn lần lượt là
10, 15), dùng đặc trưng HOG với các tham số tự chọn. Đánh giá
mô hình ANN bằng phương pháp 5-fold cross validation. Nhận xét
kết quả.