Gamar Basuki
Gamar Basuki
Gamar Basuki
“Bayesian Learning”
Name : Gamar Basuki
Class : 1 TE
NRP : 1020191013
Lecture : Dr. Ali Ridho Barakbah
Bayesian Learning
Case Study : Pengenalan Angka
No Pola 1 Pola 2 Pola 3 label
0 0 1 1 0 0 0 1 1 1 1 0 0 1 1 1 1 0
0 1 0 0 1 0 0 1 1 0 1 0 0 0 0 1
0 1 0 0 1 0 0 1 1 0 1 0 0 0 0 1
1 0 1 0 0 1 0 0 1 1 0 1 0 0 0 0 1 0
0 1 0 0 1 0 0 1 1 0 1 0 0 0 0 1
0 0 1 1 0 0 0 1 1 1 1 0 0 1 1 1 1 0
0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0
0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 1 0 0
0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0
2 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 1
0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0
0 1 1 1 1 0 0 1 1 1 1 0 0 0 1 1 0 0
Bayesian Learning
Case Study : Pengenalan Angka
No Pola 1 Pola 2 Pola 3 label
0 0 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0
0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0
0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0
3 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 2
0 0 1 1 0 0 0 1 0 0 0 0 0 0 1 1 0 0
0 1 1 1 1 0 0 1 1 1 0 0 0 1 1 1 1 0
0 1 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0
0 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0
0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0
4 3
0 1 1 1 1 0 0 0 0 1 0 0 0 0 0 1 1 0
0 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0
0 1 1 1 1 0 0 0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1 0 1 0 0 0 1 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 1 1 0 0 9
Gambar 10 0 1 1 1 0 0 0 1 0 1 0 0 0 1 1 1 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 1 1 1 0 0 9
Gambar 10 0 1 1 1 0 0 0 1 0 1 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 1 1 1 0 0 9
Case Study : Pengenalan Angka
Pemodelan Naïve Bayesian
P(f1.1 | …) 0 1 2 3 4 5 6 7 8 9
0 100% 100% 100% 100% 100% 100% 100% 100% 100% 100%
P(f1.2 | …) 0 1 2 3 4 5 6 7 8 9
0 33% 100% 33% 67% 33% 100% 33% 0% 33% 0%
1 67% 0% 67% 33% 67% 0% 67% 100% 67% 100%
P(f1.3 | …) 0 1 2 3 4 5 6 7 8 9
0 0% 0% 0% 0% 100% 0% 33% 0% 0% 0%
1 100% 100% 100% 100% 0% 100% 67% 100% 100% 100%
Model probabilitas
P(f1.4 | …) 0 1 2 3 4 5 6 7 8 9 atribut/fitur
0 0% 0% 0% 0% 67% 0% 33% 0% 0% 0%
1 100% 100% 100% 100% 33% 100% 67% 100% 100% 100%
P(f1.5 | …) 0 1 2 3 4 5 6 7 8 9
0 33% 100% 67% 100% 0% 0% 100% 0% 33% 100%
1 67% 0% 33% 0% 100% 100% 0% 100% 67% 0%
P(f1.6 | …) 0 1 2 3 4 5 6 7 8 9
0 100% 100% 100% 100% 100% 100% 100% 100% 100% 100%
1 0% 0% 0% 0% 0% 0% 0% 0% 0% 0%
Case Study : Pengenalan Angka
Pemodelan Naïve Bayesian
P(f2.1 | …) 0 1 2 3 4 5 6 7 8 9
0 67% 100% 100% 100% 100% 100% 100% 100% 100% 100%
1 33% 0% 0% 0% 0% 0% 0% 0% 0% 0%
P(f2.2 | …) 0 1 2 3 4 5 6 7 8 9
0 33% 33% 67% 33% 33% 33% 0% 67% 0% 0%
1 67% 67% 33% 67% 67% 67% 100% 33% 100% 100%
P(f2.3| …) 0 1 2 3 4 5 6 7 8 9
0 100% 0% 100% 100% 67% 67% 100% 100% 100% 100%
1 0% 100% 0% 0% 33% 33% 0% 0% 0% 0%
P(f2.4 | …) 0 1 2 3 4 5 6 7 8 9
0 100% 0% 67% 100% 100% 100% 100% 100% 100% 0%
1 0% 100% 33% 0% 0% 0% 0% 0% 0% 100% Model probabilitas
P(f2.5 | …) 0 1 2 3 4 5 6 7 8 9
atribut/fitur
0 33% 100% 33% 0% 0% 100% 100% 0% 0% 100%
1 67% 0% 67% 100% 100% 0% 0% 100% 100% 0%
P(f2.6 | …) 0 1 2 3 4 5 6 7 8 9
0 67% 100% 100% 100% 100% 100% 100% 100% 100% 100%
1 33% 0% 0% 0% 0% 0% 0% 0% 0% 0%
Case Study : Pengenalan Angka
Pemodelan Naïve Bayesian
P(f3.1 | …) 0 1 2 3 4 5 6 7 8 9
0 67% 100% 100% 100% 100% 100% 100% 100% 100% 100%
1 33% 0% 0% 0% 0% 0% 0% 0% 0% 0%
P(f3.2 | …) 0 1 2 3 4 5 6 7 8 9
0 33% 100% 100% 100% 0% 33% 0% 100% 0% 33%
1 67% 0% 0% 0% 100% 67% 100% 0% 100% 67%
P(f3.3 | …) 0 1 2 3 4 5 6 7 8 9
0 100% 0% 100% 100% 67% 67% 67% 100% 67% 0%
1 0% 100% 0% 0% 33% 33% 33% 0% 33% 100%
P(f3.4 | …) 0 1 2 3 4 5 6 7 8 9
0 100% 0% 67% 100% 67% 100% 67% 67% 100% 0%
1 0% 100% 33% 0% 33% 0% 33% 33% 0% 100% Model probabilitas
P(f3.5 | …) 0 1 2 3 4 5 6 7 8 9
atribut/fitur
0 33% 100% 33% 0% 0% 100% 67% 33% 0% 100%
1 67% 0% 67% 100% 100% 0% 33% 67% 100% 0%
P(f3.6 | …) 0 1 2 3 4 5 6 7 8 9
0 67% 100% 100% 100% 100% 100% 100% 100% 100% 100%
1 33% 0% 0% 0% 0% 0% 0% 0% 0% 0%
Case Study : Pengenalan Angka
Pemodelan Naïve Bayesian
P(f4.1 | …) 0 1 2 3 4 5 6 7 8 9
0 67% 100% 100% 100% 100% 100% 100% 100% 100% 100%
1 33% 0% 0% 0% 0% 0% 0% 0% 0% 0%
P(f4.2 | …) 0 1 2 3 4 5 6 7 8 9
0 33% 100% 100% 67% 67% 67% 0% 100% 0% 100%
1 67% 0% 0% 33% 33% 33% 100% 0% 100% 0%
P(f4.3 | …) 0 1 2 3 4 5 6 7 8 9
0 100% 0% 67% 67% 33% 33% 33% 67% 33% 100%
1 0% 100% 33% 33% 67% 67% 67% 33% 67% 0%
P(f4.4 | …) 0 1 2 3 4 5 6 7 8 9
0 100% 0% 100% 0% 33% 0% 33% 33% 0% 0%
1 0% 100% 0% 100% 67% 100% 67% 67% 100% 100% Model probabilitas
P(f4.5 | …) 0 1 2 3 4 5 6 7 8 9
atribut/fitur
0 33% 100% 33% 33% 0% 0% 0% 100% 0% 100%
1 67% 0% 67% 67% 100% 100% 100% 0% 100% 0%
P(f4.6 | …) 0 1 2 3 4 5 6 7 8 9
0 67% 100% 100% 100% 100% 100% 100% 100% 67% 100%
1 33% 0% 0% 0% 0% 0% 0% 0% 0% 0%
Case Study : Pengenalan Angka
Pemodelan Naïve Bayesian
P(f5.1 | …) 0 1 2 3 4 5 6 7 8 9
0 67% 100% 100% 100% 100% 100% 100% 100% 100% 100%
1 33% 0% 0% 0% 0% 0% 0% 0% 0% 0%
P(f5.2 | …) 0 1 2 3 4 5 6 7 8 9
0 33% 100% 67% 33% 100% 100% 0% 67% 0% 33%
1 67% 0% 33% 67% 0% 0% 100% 33% 100% 67%
P(f5.3 | …) 0 1 2 3 4 5 6 7 8 9
0 100% 0% 33% 100% 100% 100% 100% 33% 100% 100%
1 0% 100% 67% 0% 0% 0% 0% 67% 0% 0%
P(f5.4 | …) 0 1 2 3 4 5 6 7 8 9
0 100% 0% 33% 100% 100% 100% 100% 100% 100% 0%
1 0% 100% 67% 0% 0% 0% 0% 0% 0% 100% Model probabilitas
P(f5.5 | …) 0 1 2 3 4 5 6 7 8 9
atribut/fitur
0 33% 100% 100% 0% 0% 0% 0% 100% 0% 100%
1 67% 0% 0% 100% 100% 100% 100% 0% 100% 0%
P(f5.6 | …) 0 1 2 3 4 5 6 7 8 9
0 67% 100% 100% 100% 100% 100% 100% 100% 100% 100%
1 33% 0% 0% 0% 0% 0% 0% 0% 0% 0%
Case Study : Pengenalan Angka
Pemodelan Naïve Bayesian
P(f6.1 | …) 0 1 2 3 4 5 6 7 8 9
0 100% 100% 100% 100% 100% 100% 100% 100% 100% 100%
1 0% 0% 0% 0% 0% 0% 0% 0% 0% 0%
P(f6.2 | …) 0 1 2 3 4 5 6 7 8 9
0 33% 33% 0% 67% 100% 33% 0% 0% 33% 0%
1 67% 67% 100% 33% 0% 67% 100% 100% 67% 100%
P(f6.3 | …) 0 1 2 3 4 5 6 7 8 9
0 0% 0% 0% 0% 100% 0% 0% 100% 0% 0%
1 100% 100% 100% 100% 0% 100% 100% 0% 100% 100%
P(f6.4 | …) 0 1 2 3 4 5 6 7 8 9
0 0% 0% 0% 0% 100% 0% 0% 100% 0% 0%
1 100% 100% 100% 100% 0% 100% 100% 0% 100% 100% Model probabilitas
P(f6.5 | …) 0 1 2 3 4 5 6 7 8 9
atribut/fitur
0 33% 33% 33% 33% 0% 0% 33% 100% 33% 100%
1 67% 67% 67% 67% 100% 100% 67% 0% 67% 0%
P(f6.6 | …) 0 1 2 3 4 5 6 7 8 9
0 100% 100% 100% 100% 100% 100% 100% 100% 100% 100%
1 0% 0% 0% 0% 0% 0% 0% 0% 0% 0%
Case Study : Pengenalan Angka
Data Training
Keterangan f1.1 f1.2 f1.3 f1.4 f1.5 f1.6 f2.1 f2.2 f2.3 f2.4 f2.5 f2.6 f3.1 f3.2 f3.3f3.4 f3.5 f3.6 f4.1 f4.2 f4.3 f4.4 f4.5 f4.6 f5.1 f5.2 f5.3 f5.4 f5.5 f5.6 f6.1 f6.2 f6.3 f6.4 f6.5 f6.6 Label
Gambar 1 0 0 1 1 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 1 1 0 0 0
Gambar 3 0 1 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 1 1 0 0 2
Gambar 10 0 1 1 1 0 0 0 1 0 1 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 1 1 1 0 0 9
Gambar 8 0 1 1 1 1 0 0 1 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 7
Gambar 5 0 0 0 1 1 0 0 0 1 0 1 0 0 1 0 0 1 0 0 1 1 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 4
Gambar 9 0 1 1 1 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 1 1 1 0 0 1 0 0 1 0 0 1 1 1 1 0 8
Data Testing
Data Testing untuk No 3
adalah pada gambar 10, dan No 0 1 2 3 4 5 6 7 8 9 Nilai yang digunakan untuk
pada gambar 10 1 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% data testing ke 3 adalah
2 0% 0% 0% 0% 0% 0% 0% 0% 0% 0%
menunjukkan class label 9. sama persiang pada data
3 0% 0% 0% 0% 0% 0% 0% 0% 0% 2%
Sementara untuk hasil pada 4 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% training yang memiliki class
data testing hasinlya adalah 5 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% lable 9
class labelnya adalah 9 6 0% 0% 0% 0% 0% 0% 0% 0% 1% 0%
//1 //2
{ {
{0, 0, 1, 1, 0, 0}, {0, 0, 1, 1, 0, 0},
{0, 1, 1, 1, 0, 0}, {0, 1, 0, 0, 1, 0},
{0, 0, 1, 1, 0, 0}, {0, 0, 0, 0, 1, 0},
{0, 0, 1, 1, 0, 0}, {0, 0, 0, 0, 1, 0},
{0, 0, 1, 1, 0, 0}, {0, 0, 1, 1, 0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, 0, 0}, {0, 0, 0, 1, 1, 0},
{0, 1, 0, 0, 1, 0}, {0, 0, 1, 0, 1, 0},
{0, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 1, 0},
{0, 0, 0, 1, 1, 0}, {0, 1, 1, 1, 1, 0},
{0, 1, 0, 0, 1, 0}, {0, 0, 0, 0, 1, 0},
{0, 0, 1, 1, 0, 0}, {0, 0, 0, 0, 1, 0},
}, },
Coding Naïve bayesian
//5 //6
{ {
{0, 0, 1, 1, 1, 0}, {0, 1, 0, 0, 0, 0},
{0, 0, 1, 0, 0, 0}, {0, 1, 0, 0, 0, 0},
{0, 0, 1, 0, 0, 0}, {0, 1, 1, 1, 1, 0},
{0, 0, 0, 1, 1, 0}, {0, 1, 0, 0, 1, 0},
{0, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 1, 0},
{0, 0, 1, 1, 1, 0}, {0, 1, 1, 1, 1, 0},
}, },
{ {
{0, 0, 1, 1, 1, 0}, {0, 0, 1, 1, 0, 0},
{0, 1, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0},
{0, 1, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0},
{0, 0, 1, 1, 1, 0}, {0, 1, 1, 1, 1, 0},
{0, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 1, 0},
{0, 1, 1, 1, 1, 0}, {0, 1, 1, 1, 0, 0},
}, },
{ {
{0, 0, 1, 1, 1, 0}, {0, 1, 1, 1, 0, 0},
{0, 1, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0},
{0, 1, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0},
{0, 1, 1, 1, 1, 0}, {0, 1, 1, 1, 1, 0},
{0, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 1, 0},
{0, 1, 1, 1, 1, 0}, {0, 1, 1, 1, 1, 0},
}, },
Coding Naïve bayesian
……………………………………………………………………………………..
……………………………………………………………………………………
//Data Test //class lable 6
int in[6][6]={
/*{0, 1, 0, 0, 0, 0},
//class lable 9
{0, 1, 0, 0, 0, 0},
/*{0, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 0},
{0, 1, 0, 1, 0, 0},
{0, 1, 0, 0, 1, 0},
{0, 0, 1, 1, 0, 0},
{0, 1, 0, 0, 1, 0},
{0, 0, 0, 1, 0, 0},
{0, 1, 1, 1, 1, 0},*/
{0, 1, 0, 1, 0, 0},
{0, 1, 1, 1, 0, 0},*/
//class lable 1
{0, 0, 1, 1, 0, 0},
//class lable8
{0, 1, 1, 1, 0, 0},
/*{0, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 0, 0},
{0, 1, 0, 0, 1, 0},
{0, 0, 1, 1, 0, 0},
{0, 1, 1, 0, 1, 0},
{0, 0, 1, 1, 0, 0},
{0, 1, 0, 1, 1, 0},
{0, 1, 1, 1, 1, 0},
{0, 1, 0, 0, 1, 0},
{0, 1, 1, 1, 1, 0},*/
};
//class lable 4
/*{0, 0, 0, 1, 1, 0},
{0, 0, 1, 0, 1, 0},
{0, 1, 0, 0, 1, 0},
{0, 1, 1, 1, 1, 0},
{0, 0, 0, 0, 1, 0},
{0, 0, 0, 0, 1, 0},*/
Coding Naïve bayesian
…………………………………………………………….
…………………………………….
//data classifier //data probability and target class label
probcl=dcl/m;
p[0].result*=probcl; p[0].target=0;
// cout<<probcl<<endl;
p[1].result*=probcl; p[1].target=1;
for(n=0; n<30; n++){
p[2].result*=probcl; p[2].target=2;
// cout<<cl[n].target<<"\tiki"<<endl;
p[3].result*=probcl; p[3].target=3;
for(x=0; x<6; x++){
p[4].result*=probcl; p[4].target=4;
for(y=0; y<6; y++){
p[5].result*=probcl; p[5].target=5;
cout<<arr[n][x][y];
p[6].result*=probcl; p[6].target=6;
// cout<<in[x][y];
p[7].result*=probcl; p[7].target=7;
if(in[x][y]==1){
p[8].result*=probcl; p[8].target=8;
if(cl[n].target==0) {
p[9].result*=probcl; p[9].target=9;
nol[x][y].result=(nol[x][y].result+arr[n][x][y]);
…………………………………………
if(n==2){
nol[x][y].result/=3;
cout<<"="<<nol[x][y].result;
p[0].result*=nol[x][y].result;
}
}
else if(cl[n].target==1) {
satu[x][y].result=(satu[x][y].result+arr[n][x][y]);
if(n==5){
satu[x][y].result/=3;
cout<<"="<<satu[x][y].result;
p[1].result*=satu[x][y].result;
}
}
……………………………………………………………………..
Hasil Running Coding Naïve bayesian
1 2
Hasil Running Coding Naïve bayesian
3 4
Hasil Running Coding Naïve bayesian
5 6
Data testing
//class lable 1
{0, 0, 1, 1, 0, 0},
{0, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 0, 0},
{0, 0, 1, 1, 0, 0},
{0, 0, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 0},
Analisa Hasil Running Coding Naïve Bayesian
yang mengalami beberapa problem
//class lable 6
{0, 1, 1, 1, 0, 0},
{0, 1, 0, 0, 0, 0},
{0, 1, 0, 0, 0, 0},
{0, 1, 1, 1, 1, 0},
{0, 1, 0, 0, 1, 0},
{0, 1, 1, 1, 1, 0},
Analisa :
Pada saat menggunakan data testing seperti data
di atas yaitu memilik class lable 6 tetapi pada hasil
running menunjukkan data memiliki class lable 8.
Artinya masih belum semua data testing bisa sesuai
untuk menunukkan class lable yang dituju dengan
menggunakan naïve Bayesian pada program ini.