Modul 7 (Neural Network & Evaluasi)
Modul 7 (Neural Network & Evaluasi)
PERTEMUAN 7
www.esaunggul.ac.id
Kemampuan Akhir Pertemuan 7
www.esaunggul.ac.id
Outline
• Neural Networks
• Pendahuluan Evaluasi Performa
• Confusion Matrix
• Akurasi
• Precision,
• Recall
• F measure
Let starts with Perceptron
Y = sign( wi X i − t )
i
Perceptron
Input
nodes Black box
X1 X2 X3 Y
1 0 0 0 Output
1 0 1 1
X1 0.3 node
1 1 0 1
1 1 1 1 X2 0.3
0 0 1 0
Y
0 1 0 0
0 1 1 1 X3 0.3 t=0.4
0 0 0 0
x1 x2 x3 x4 x5
Input
Layer Input Neuron i Output
I1 wi1
wi2 Activation
I2
wi3
Si function Oi Oi
Hidden g(Si )
Layer I3
threshold, t
Output
Training ANN means learning
Layer
the weights of the neurons
y
How A Multi-Layer ANN Works
• The inputs to the network correspond to the attributes measured for each
training tuple
• Inputs are fed simultaneously into the units making up the input layer
• They are then weighted and fed simultaneously to a hidden layer
• The number of hidden layers is arbitrary, although usually only one
• The weighted outputs of the last hidden layer are input to units making up
the output layer, which emits the network's prediction
• The network is feed-forward: None of the weights cycles back to an input unit
or to an output unit of a previous layer
• From a statistical point of view, networks perform nonlinear regression: Given
enough hidden units and enough training samples, they can closely
approximate any function
Defining a Network Topology
E = Yi − f ( wi , X i )
2
Strength
• Kemudian performa
dan model yang
dihasilkan perlu
dievaluasi agar dapat
digunakan dalam
bisnis/dunia nyata.
Evaluasi Performa
HASIL PREDIKSI
positif negatif
false negatives
positif true positives (TP)
LABEL (FN)
SEBENARNYA true negatives
negatif false positives (FP)
(TN)
Confusion Matrix
HASIL PREDIKSI
positif negatif
• Ketika hasil prediksi metode klasifikasi mengatakan positif dan label yang
seharusnya adalah positif, maka kita matrix ini menyatakan true positif
(memang benar positif). Demikian juga, jika hasil prediksi negatif dan
memang label negatif, kita katakan true negatif (sesuai)
• Namun jika hasil prediksi menyatakan pasien positif Covid-19 padahal
sebenarnya negatif (labelnya) maka kejadian ini disebut false positif (yaitu
kesalahan dalam memprediksi positif) dan jika sebaliknya maka disebut
false negatif.
HASIL PREDIKSI
positif negatif
HASIL PREDIKSI
positif negatif
positif 60 6
LABEL
SEHARUSNYA negatif 4 30
Metrik
• Dari confusion matrix, dapat diturunkan beberapa metrik untuk mengukur
performa model klasifikasi seperti:
– Akurasi
– Precision,
– Recall
– F measure
Akurasi
• Akurasi adalah nilai total dari prediksi yang tepat yaitu dari True Positive
(TP) dan True Negative (TN). Perhitungannya adalah sebagai berikut:
• Presisi adalah perbandingan dari prediksi positif yang tepat terhadap total
prediksi yang positif. Perhitungannya adalah sebagai berikut:
• Selain membagi dataset menjadi 2 yaitu training set dan test set, terdapat
metode evaluasi performa lainnya seperti:
– Cross validation
– Kurva receiver operating characteristic
Referensi