Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/346508593

Perhitungan Manual Metode Correlated Naïve Bayes Classifier

Method · December 2020

CITATIONS READS
0 3,058

1 author:

Hairani Hairani
Universitas Bumigora
39 PUBLICATIONS 143 CITATIONS

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Expert System View project

Class Imbalance Handling View project

All content following this page was uploaded by Hairani Hairani on 01 December 2020.

The user has requested enhancement of the downloaded file.


Perhitungan Manual Metode Correlated Naïve Bayes Classifier

Tabel 3.2 Data Training

Age Number Times Of Pregnant Class

22 1 Tested Negative

22 2 Tested Negative
22 1 Tested Negative
26 5 Tested Negative
23 4 Tested Negative
26 3 Tested Positive
37 5 Tested Positive
31 7 Tested Positive
26 4 Tested Positive
22 4 Tested Positive

Tabel 3.3 Data Testing


Age Number Times Of Pregnant Class

22 1 Tested Negative

Langkah Perhitungan Metode Correlated Naïve Bayes


1. Transformasi Atribut tipe non-numerik ke numerik

No. Data Non Numerik Data Numerik


1. Tested Negative 1
2. Tested Positive 2

2. Menghitung korelasi atribut dengan kelas nya.


Pada kasus diatas kita akan menghitung Korelasi atribut Age (X1) dengan kelasnya (Y) dan
Atribut Number time of Pregnant (X2) dengan kelasnya (Y)
Rumus perhitungan Korelasi Pearson

Rumus perhitungan R-Square

R square ini yang dipakai pada korelasi metode C-NBC


Contoh perhitungan korelasinya.
Number Times
Age Class Class
Of Pregnant
(X1) (Y) (Y)
(X2)
22 1 Tested Negative 1 484 1 1 22 1
22 2 Tested Negative 1 484 4 1 22 2
22 1 Tested Negative 1 484 1 1 22 1
26 5 Tested Negative 1 676 25 1 26 5
23 4 Tested Negative 1 529 16 1 23 4
26 3 Tested Positive 2 676 9 4 52 6
37 5 Tested Positive 2 1369 25 4 74 10
31 7 Tested Positive 2 961 49 4 62 14
26 4 Tested Positive 2 676 16 4 52 8
22 4 Tested Positive 2 484 16 4 44 8

257 36 15 6823 162 25 399 59


a. Perhitungan Korelasi atribut Age (X1) dengan Kelasnya (Y)

𝑛. (∑ 𝑋𝑌) − (∑ 𝑋). (∑ 𝑌)
𝑟=
√(𝑛. ∑ 𝑋 2 − (∑ 𝑋)2 )√(𝑛. ∑ 𝑌 2 − (∑ 𝑌)2 )
10. (399) − (257). (15)
𝑟=
√(10 ∗ 6823) − ((257)2 √(10 ∗ 25) − (15)2
3990 − 3855
𝑟=
√(68230 − 66049)√(250) − 225
135
𝑟=
√2181√25
135
𝑟=
46,701 ∗ 5
135
𝑟=
233,505
𝑟 𝐴𝑔𝑒(𝑋1) = 0,578
Dari nilai r Atribut Age(X1) diatas kita jadikan nilai korelasi R-Square dengan Rumus:
𝑅 𝑆𝑞𝑢𝑎𝑟𝑒 = 𝑟 2
𝑅 𝑆𝑞𝑢𝑎𝑟𝑒 = 0,5782
𝑅 𝑆𝑞𝑢𝑎𝑟 (𝐴𝑔𝑒) = 0,334
Kita dapatkan nilai Korelasi R Square Age (X1) sebesar 0,334
b. Perhitungan Korelasi Atribut Number time of Pregnant (X2) dengan kelasnya (Y)

𝑛. (∑ 𝑋𝑌) − (∑ 𝑋). (∑ 𝑌)
𝑟=
√(𝑛. ∑ 𝑋 2 − (∑ 𝑋)2 )√(𝑛. ∑ 𝑌 2 − (∑ 𝑌)2 )
10. (𝟓𝟗) − (𝟑𝟔). (15)
𝑟=
√(10 ∗ 𝟏𝟔𝟐) − ((𝟑𝟔)2 √(10 ∗ 25) − (15)2
590 − 540
𝑟=
√(1620 − 1296)√(250) − 225
50
𝑟=
√324√25
50
𝑟=
18 ∗ 5
50
𝑟=
90
𝑟 Number time of Pregnant (𝐗𝟐) = 0,555
Dari nilai r Atribut Number time of Pregnant (X2) diatas kita jadikan nilai korelasi R-
Square dengan Rumus:
𝑅 𝑆𝑞𝑢𝑎𝑟𝑒 = 𝑟 2
𝑅 𝑆𝑞𝑢𝑎𝑟𝑒 = 0,5552
𝑅 𝑆𝑞𝑢𝑎𝑟 (𝐴𝑔𝑒) = 0,308
Kita dapatkan nilai Korelasi R Square Number time of Pregnant (X2) sebesar 0,308

Atribut R Square

Age (X1) 0,334


Number o Pregnant (X1) 0,308

Langkah 3: Menghitung prior probability

Prior Probability
Sum Class N
Tested Positive
5 10
Tested Negative 5

5
P(X |Tested Positive ) = = 0,5
10
5
P(X |Tested Negative )= = 0,5
10

Langkah 4 : Menghitung probabilitas independen kelas Y dari semua fitur dalam vektor X:
Lihat Tabel 3.2 Data Training dan Tabel 3.3 Data Testing.
1+1
P(𝑇𝑒𝑠𝑡𝑒𝑑 𝑃𝑜𝑠𝑖𝑡𝑖𝑣𝑒|Age = 22) = = 0,4
5
3+1
P(Tested Negative|Age = 22) = = 0,8
5

0+1
P(𝑇𝑒𝑠𝑡𝑒𝑑 𝑃𝑜𝑠𝑖𝑡𝑖𝑣𝑒|𝑁𝑢𝑚𝑏𝑒𝑟 𝑡𝑖𝑚𝑒𝑠 𝑜𝑓 𝑝𝑟𝑒𝑔𝑛𝑎𝑛𝑡 = 1) = = 0,2
5
2+1
P(𝑇𝑒𝑠𝑡𝑒𝑑 𝑁𝑒𝑔𝑎𝑡𝑖𝑣𝑒|𝑁𝑢𝑚𝑏𝑒𝑟 𝑡𝑖𝑚𝑒𝑠 𝑜𝑓 𝑝𝑟𝑒𝑔𝑛𝑎𝑛𝑡 = 1) = = 0,6
5
• Langkah 4 :Menghitung perkalian:
P(Kelas Tested Positive |X) = (P(Kelas Tested Positive |Age=22) * R(Kelas Tested Positive |Age = 22)) +
(P(Kelas Tested Positive |Number Times of Pregnant = 1) * R(Kelas Tested Positive |Number
Times of Pregnant=1)) * P(X| Tested Positive) = (0,4 * 0,334) + (0,2 * 0,308) * 0,5 = 0.1644
P(Kelas Tested Negative |X) = (P(Kelas Tested Negative |Age=22) * R(Kelas Tested Negative |Age = 22)) +
(P(Kelas Tested Negative | Number Times of Pregnant = 1) * R(Kelas Tested Negative | Number
Times of Pregnant = 1)) * P(X| Tested Negative) = (0,8 * 0,334) + (0,6 * 0,308) * 0,5 =0.3596
• Langkah 5 : Menghitung nilai max dari probabilitas akhir:
P(ClassTested Positive|X) = 0,1644
P(ClassTested Negative|X) = 0,3596
Nilai probabilitas kelas Tested Negative lebih besar dari nilai probabilitas kelas Tested Positive, sehingga
data tersebut diklasifikasikan ke dalam kelas Tested Negative.

View publication stats

You might also like