04a ANN MLP
04a ANN MLP
Multi-Layer Perceptron
Backpropagation
x1 w
x2
.
.
y
.
xp w
Perceptron
• Jika manusia punya 10 milyar neuron, apa yang
bisa dilakukan?
• Sangat banyak hal bisa dilakukan
• Apalagi jika Multiple Intelligence
• Perceptron = MODEL SEDERHANA dari neuron
• Apa yang bisa dilakukan oleh satu perceptron?
• Klasifikasi
• Prediksi
• Optimasi, …
AND
x1 x2 y
x2 0 0 0
0 1 0
1 0 0
1 1 1
x1
0 1
x1 + x2 – 1,5 = 0
w1.x1 + w2.x2 – 1,5 = 0
AND
x1 x2 y
0 0 0
0 1 0
1 0 0
1 1 1
x1 w=1
y y
x2 w=1 θ = 1,5
OR
x1 x2 y
x2 0 0 0
0 1 1
1 0 1
1 1 1
x1
0 1
x1 + x2 – 0,5 = 0
OR
x1 x2 y
0 0 0
0 1 1
1 0 1
1 1 1
x1 w=1
y y
x2 w=1 θ = 0,5
XOR
x1 x2 y
x2 0 0 0
x1 - x2 + 0,5 = 0 0 1 1
1 0 1
1 1 0
x1
0 1
x1 - x2 - 0,5 = 0
XOR x1 x2 y
0 0 0
0 1 1
1 0 1
1 1 0
θ = 0,5
w = -1
x1 y w=1
w=1
y y
w=1
θ = 0,5
x2 y w=1
w = -1
θ = 0,5
3 elemen input 3 dimensi
Perceptron Network
x1 w
y
x2
. y
.
.
xp y
w
Learning
Bagaimana menemukan
weights yang tepat?
Meminimumkan error
x2
x1
w1x1 + w2x2 - θ= 0
x2
x1
Activation Functions
• Hard Limit
• Threshold
• Linear (Identity)
• Sigmoid
• Radial Basis Function (RBF)
• …
Hard Limit
Threshold
Symetric Hard Limit
Bipolar Threshold
Linear (Identity)
Piecewise-linear
Symetric Piecewise-linear
Sigmoid atau sigmoid biner
Sigmoid Symetric (Bipolar)
Radial Basis Function (RBF)
Arsitektur ANN
• Para ahli memodelkan sel syaraf otak manusia
ke dalam berbagai arsitektur ANN (susunan
neuron) yang berbeda-beda.
• Masing-masing arsitektur menggunakan
algoritma belajar khusus.
Hanya memproses informasi
numerik
Single-Layer Feedforward Networks
Multi-Layer Feedforward Networks
Recurrent Networks
Lattice Structure (satu dimensi, 3 neurons)
Lattice Structure (dua dimensi, 3x3 neurons)
Proses Belajar (Learning)
Perceptron: Model
Perceptron: Signal-Flow Graph
Decision boundary
x2
x1
w1x1 + w2x2 - θ= 0
Decision boundary
Pelamar IPK Psikologi Wawancara Diterima
P1 3 3 2 1
P2 3 2 2 1
P3 3 2 1 1
P4 3 1 1 0
P5 2 3 2 1
P6 2 2 2 1
P7 2 2 1 1
P8 2 1 1 0
P9 1 3 2 1
P10 1 2 1 0
P11 1 1 2 1
Visualisasi 100 dimensi?
W1&B1 W2 & B2
1 1
Error Surface
error
weights
Matriks P Matriks T
Pix Pix Pix Pix Pix Pix
Pola … N1 N2 N3 N4 Kelas
1 2 3 4 5 100
E1 0 0 1 1 1 … 0 1 0 0 0 E
F1 0 0 1 1 1 … 0 0 1 0 0 F
G1 0 1 1 1 1 … 1 0 0 1 0 G
O1 0 1 1 1 1 … 1 0 0 0 1 O
E2 0 0 1 1 1 … 0 1 0 0 0 E
… … … … … … … … … … … … …
O5 0 1 1 1 1 … 1 0 0 0 1 O
W1 & W2: Random W1 W2
Training
-0.54
0.71 A1 A2 T E
-0.52
-0.21
-0.21
0.15 0.7 0.9 1 0.1
0.34
0.75 -0.12
0.45
0.9
W1 & W2: Trained W1 W2
Testing
0.01 A2 Kelas
0.31
-0.83 0.8 1
-0.38
0.19
0.74
0.34 0.35 0.2 0
0.22
0.87
0.62 -0.18
0.1 0
0.30
0.60
0.98
0.03
-0.53 0.2 0
-0.38 -0.09
Permasalahan pada MLP
• Bagaimana struktur ANN yang optimal?
– Jumlah hidden layer
– Jumlah neuron pada hidden layer
– Jumlah neuron pada output layer
– Fungsi aktivasi yang optimal
• Berapa besarnya Learning Rate yang ideal?
• Kapan Menghentikan Learning
Jumlah neuron pada hidden layer?
x1
Algoritma Belajar Propagasi Balik
• Pelatihan Jaringan
– Perhitungan Mundur
Learning Rate: Kecil
x2
x1
Kapan Menghentikan Learning?
Berhenti !
x2
x1
w1x1 + w2x2 - θ= 0
Decision boundary
Overfit, Oversize, Flexible
Studi Kasus
• Klasifikasi
• Verifikasi
• Validasi
• Prediksi
• Optimasi
Kasus 1 Verifikasi tandatangan
• OFFLINE atau ONLINE?
• Citra: 100 x 100 pixel grayscale
• Satu juta tandatangan?
8.600.000
8.400.000
Jumlah pelanggan PSTN PT Telkom
8.200.000
8.000.000
7.800.000
7.600.000
8.660.000
8.640.000
8.620.000
Jumlah pelanggan PSTN PT Telkom
8.600.000
8.580.000
8.560.000
8.540.000
5 bulan
Acc APE < 1%
Ekstrapolasi
Skenario 3 8 bulan
Acc. APE < 1%
Kasus 4: Deteksi Kecurangan
• Jumlah pelanggan: 10 juta
• Data yg tersedia: tagihan bulanan selama 5
tahun
• Kecurangan:
– Jika tagihan pada bulan ini jauh lebih sedikit atau
lebih besar dibandingkan bulan-bulan sebelumnya
– Jika tunggakan lebih dari 3 bulan dengan total
tagihan jauh lebih besar dibandingkan bulan-
bulan sebelumnya
Formulasi Masalah
• Input & Output?
• P dan T?
• Struktur dan parameter MLP?
• Perlu preprocessing?
Kasus 5: Deteksi Churn