Successfully reported this slideshow.
Upcoming SlideShare
×

# Dm 07-naive bayes

506 views

Published on

Published in: Technology, Education
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

### Dm 07-naive bayes

1. 1. novi.setiani@gmail.comApril 2013Materi Kuliah – [7]:Data MiningNaive Bayes
2. 2. Tid Refund MaritalStatusTaxableIncome Cheat1 Yes Single 125K No2 No Married 100K No3 No Single 70K No4 Yes Married 120K No5 No Divorced 95K Yes6 No Married 60K No7 Yes Divorced 220K No8 No Single 85K Yes9 No Married 75K No10 No Single 90K Yes10RefundMarStTaxIncYESNONONOYes NoMarriedSingle, Divorced< 80K > 80KSplitting AttributesModel: Decision TreeRecall: Pohon Keputusan
3. 3. Klasifikasi Bayesian Problem:– Diberikan himpunan atribut X = {x1, x2... xn}– Prediksi nilai atribut kelas YSolusi:Cari probabilitas tertinggi untuk nilai Y jika diberikan himpunanatribut X.
4. 4. ProblemHimpunan atribut X = {Refund,Marital status, Taxableincome}Atribut kelas Y: Cheat= {Yes,No}Diketahui data:Refund MaritalStatusTaxableIncome CheatNo Married 80K ?10Tid Refund MaritalStatusTaxableIncome Cheat1 Yes Single 125K No2 No Married 100K No3 No Single 70K No4 Yes Married 120K No5 No Divorced 95K Yes6 No Married 60K No7 Yes Divorced 220K No8 No Single 85K Yes9 No Married 75K No10 No Single 90K Yes10
5. 5. SolusiCari probabilitas:P1 = P(Cheat=yes|Refund=No,MaritalStatus=Married,Taxable Income=80K)P1 = P(Cheat=no|Refund=No,MaritalStatus=Married,Taxable Income=80K)Jika P1 > P2, maka Cheat = yes.Jika P1 < P2, maka Cheat = noP1 = P2? Pilih salah satu.
6. 6. Teorema BayesBagaimana mencari nilai P(Y|x1,...xn) ?Gunakan teorema Bayes:Fungsi normalization constant: tidak tergantung nilai Ysehingga nilainya tetap antara P1 dan P2 → tidak perludihitung.Normalization ConstantLikelihood Prior
7. 7. Teorema BayesP(Y)P(X1, …, Xn|Y) =P(Y)P(X1|Y)P(X2,..,Xn|Y,X1)= P(Y)P(X1|Y)P(X2|Y,X1)P(X3,..,Xn|Y,X1,X2)= P(Y)P(X1|Y)P(X2|Y,X1)P(X3|Y,X1,X2)...P(Xn|Y,X1,X2,X3,... Xn-1).Terlalu banyak parameterLamaTempat yang besarData yang banyak
8. 8. Naive BayesAsumsi Naïve Bayes : Jika diberikan atribut kelas Y,seluruh atribut X bersifat independen (tidak tergantungsatu sama lain) → Tidak ada hubungan antar atribut X.YXn...X2X1YXnX2X1 ...
9. 9. Naive BayesP(Y)P(X1, …, Xn|Y) = P(Y)P(X1|Y)P(X2|Y,X1)P(X3|Y,X1,X2)...P(Xn|Y,X1,X2,X3,... Xn-1).P(Y)P(X1, …, Xn|Y) =P(Y)P(X1|Y)P(X2|Y)P(X3|Y)...P(Xn|Y)P(Y) = Jumlah kemunculan Y/Jumlah dataP(Xi|Y) = Jumlah Xi dan Y /Jumlah kemunculan Y