langkah awal adalah buat rancangan form seperti gambar di bawa ini;
Tabel Property;
Code Program
Option Explicit On
Private Declare Function
ShellExecute Lib _
"shell32.dll"
Alias "ShellExecuteA"
_
(ByVal
hwnd As Long, _
ByVal
lpOperation As String,
_
ByVal
lpFile As String,
_
ByVal
lpParameters As String,
_
ByVal
lpDirectory As String,
_
ByVal
nShowCmd As Long)
As Long
Private Const SW_SHOWNORMAL = 1
Public Conn As ADODB.Connection
Dim Rst As New
ADODB.Recordset
Public Function konek() As Boolean
On
Error GoTo out
Conn = New
ADODB.Connection
Conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
App.Path & "\Dataset.mdb;Persist Security
Info=False")
Conn.CursorLocation = adUseClient
konek = True
out:
End Function
Private Sub CmdPredeksi_Click()
Dim
ProbiYes, ProbiNo As Double
Dim
Y_Tepat, Y_Terlambat As Integer
Dim
CounDtSet As Integer
Dim
Klm_Tepat, Klm_Terlambat As Integer
Dim
Mhs_Tepat, Mhs_Terlambat As Integer
Dim
Nk_Tepat, Nk_Terlambat As Integer
Dim
Ipk_Tepat, Ipk_Terlambat As Integer
'total
data terning
Rst.Open("select
count(*) as Hsl from Tb_Trening", Conn, adOpenKeyset,
adLockOptimistic)
CounDtSet = Rst!hsl
Rst.Close()
'total
data trening dengan keterangan TEPAT
Rst.Open("select
count(*) as Hasil from Tb_Trening where KETERANGAN ='TEPAT'", Conn,
adOpenKeyset)
Y_Tepat = Rst!Hasil
Rst.Close()
'total
data trening dengan keterangan TERLAMBAT
Rst.Open("select
count(*) as Hasil from Tb_Trening where KETERANGAN='TERLAMBAT'",
Conn, adOpenKeyset)
Y_Terlambat = Rst!Hasil
Rst.Close()
'************** JENIS KELAMIN
**********************
Rst.Open("select
count(*) as Hsl from Tb_Trening where KELAMIN = '" &
CboKelamin.Text & "' and KETERANGAN
='TEPAT'", Conn, adOpenKeyset)
Klm_Tepat = Rst!hsl ' 'menampung nilai ke variabel
Rst.Close()
Rst.Open("select
count(*) as Hsl from Tb_Trening where KELAMIN = '" &
CboKelamin.Text & "' and KETERANGAN
='TERLAMBAT'", Conn, adOpenKeyset)
Klm_Terlambat = Rst!hsl 'menampung nilai ke variabel
Rst.Close()
'************** STATUS MAHASISWA **********************
Rst.Open("select
count(*) as Hsl from Tb_Trening where STATUS_MHS = '" &
CboStatus.Text & "' and KETERANGAN
='TEPAT'", Conn, adOpenKeyset)
Mhs_Tepat = Rst!hsl ' 'menampung nilai ke variabel
Rst.Close()
Rst.Open("select
count(*) as Hsl from Tb_Trening where STATUS_MHS = '" &
CboStatus.Text & "' and KETERANGAN
='TERLAMBAT'", Conn, adOpenKeyset)
Mhs_Terlambat = Rst!hsl 'menampung nilai ke variabel
Rst.Close()
'************** STATUS PERNIKAHAN **********************
Rst.Open("select
count(*) as Hsl from Tb_Trening where ST_PRENIKAHAN = '" &
CboNikah.Text & "' and KETERANGAN
='TEPAT'", Conn, adOpenKeyset)
Nk_Tepat = Rst!hsl ' 'menampung nilai ke variabel
Rst.Close()
Rst.Open("select
count(*) as Hsl from Tb_Trening where ST_PRENIKAHAN = '" &
CboNikah.Text & "' and KETERANGAN
='TERLAMBAT'", Conn, adOpenKeyset)
Nk_Terlambat = Rst!hsl 'menampung nilai ke variabel
Rst.Close()
'************** IPK SEMSTER 1 s/d 6 **********************
Rst.Open("select
count(*) as Hsl from Tb_Trening where IPK = '" &
MaskEdBox1.Text & "' and KETERANGAN
='TEPAT'", Conn, adOpenKeyset)
Ipk_Tepat = Rst!hsl ' 'menampung nilai ke variabel
Rst.Close()
Rst.Open("select
count(*) as Hsl from Tb_Trening where IPK = '" &
MaskEdBox1.Text & "' and KETERANGAN
='TERLAMBAT'", Conn, adOpenKeyset)
Ipk_Terlambat = Rst!hsl 'menampung nilai ke variabel
Rst.Close()
'MENJUMLAHKAN
NILAI PROBALITAS
ProbiYes = (Klm_Tepat / Y_Tepat)
* (Mhs_Tepat / Y_Tepat) * (Nk_Tepat / Y_Tepat) * (Ipk_Tepat / Y_Tepat) *
(Y_Tepat / CounDtSet)
ProbiNo = (Klm_Terlambat /
Y_Terlambat) * (Mhs_Terlambat / Y_Terlambat) * (Nk_Terlambat / Y_Terlambat) *
(Ipk_Terlambat / Y_Terlambat) * (Y_Terlambat / CounDtSet)
'MEMBANDINGKAN
HASIL
If
ProbiYes > ProbiNo Then
TxtHasil.Text = "LULUS TEPAT WAKTU"
Else
TxtHasil.Text = "LULUS TERLAMBAT"
End
If
If
ProbiYes = ProbiNo Then
TxtHasil.Text = "KEMUNGKINAN LULUS TEPAT WAKTU"
End
If
'PRINT
TO LIST
List1.Width = 6255
List1.Left = 4680
List1.AddItem("PERHITUNGAN NAIVE BAYES")
List1.AddItem("===================================")
List1.AddItem("")
List1.AddItem("")
List1.AddItem("P(KELAMIN=" & CboKelamin.Text &
"TEPAT) = " & Klm_Tepat & " / " & Y_Tepat)
List1.AddItem("P(KELAMIN=" & CboKelamin.Text &
"TERLAMBAT) = " &
Klm_Terlambat & " / " &
Y_Terlambat)
List1.AddItem("")
List1.AddItem("P(STATUS MAHASISWA=" &
CboStatus.Text & "TEPAT) = "
& Mhs_Tepat & " / " &
Y_Tepat)
List1.AddItem("P(STATUS MAHASISWA=" &
CboStatus.Text & "TERLAMBAT) = "
& Mhs_Terlambat & " / "
& Y_Terlambat)
List1.AddItem("")
List1.AddItem("P(STATUS PERNIKAHAN=" &
CboNikah.Text & "TEPAT) = "
& Nk_Tepat & " / " &
Y_Tepat)
List1.AddItem("P(STATUS PERNIKAHAN=" &
CboNikah.Text & "TERLAMBAT) = "
& Nk_Terlambat & " / "
& Y_Terlambat)
List1.AddItem("")
List1.AddItem("P(IPK=" & MaskEdBox1.Text & "TEPAT) = " & Ipk_Tepat & " / " & Y_Tepat)
List1.AddItem("P(IPK=" & MaskEdBox1.Text & "TERLAMBAT) = " & Ipk_Terlambat
& " / " & Y_Terlambat)
List1.AddItem("")
List1.AddItem("======================================")
List1.AddItem("")
List1.AddItem("P(TEPAT) = (" & Klm_Tepat & " / " & Y_Tepat & ") * (" & Mhs_Tepat & " / " & Y_Tepat & ") * ( " & Nk_Tepat & " / " & Y_Tepat & ") * (" & Ipk_Tepat & " / " & Y_Tepat & ") * (" & Y_Tepat & " / " & CounDtSet & ")")
List1.AddItem("P(TERLAMBAT) = (" & Klm_Terlambat
& " / " & Y_Terlambat
& ") * (" & Mhs_Terlambat
& " / " & Y_Terlambat
& ") * (" & Nk_Terlambat
& " / " & Y_Terlambat
& ") * (" & Ipk_Terlambat
& " / " & Y_Terlambat &
") * (" & Y_Terlambat & " / " & CounDtSet & ")")
List1.AddItem("")
List1.AddItem("P(TEPAT) =" & ProbiYes)
List1.AddItem("P(TERLAMBAT) =" & ProbiNo)
List1.AddItem(TxtHasil.Text)
List1.AddItem("")
End Sub
Private Sub Cmdreset_Click()
CboKelamin.Clear()
CboStatus.Clear()
CboNikah.Clear()
MaskEdBox1.Text = "_.__"
List1.Left = 7320
List1.Width = 3615
End Sub
Private Sub Command1_Click()
MsgBox("Http://Edukasi-informatika.blogspot.com
")
ShellExecute(Me.hwnd, _
vbNullString, _
vbNullString, _
"c:\",
_
SW_SHOWNORMAL)
End Sub
Private Sub Form_Load()
If
Not konek() Then
MsgBox("Gak bisa terhubung ke database!",
vbCritical)
End
End
If
Adodc1.ConnectionString =
Conn.ConnectionString
Adodc1.RecordSource = "Tb_Trening"
DataGrid1.DataSource = Adodc1
MaskEdBox1.Mask = "#.##"
End Sub
Download ; Source Code. Rar
Naive Bayes Implemantasi.pdf
mas klo di implementasi di java gmana ya???
BalasHapusPahami konsep perhitungan Naive Bayaes..
Hapushttp://education-programmer.blogspot.com/2013/01/perhitungan-sederhana-naive-bayes-untuk.html
mas...bisa minta databases nya?
BalasHapusdatabase x sdh disertakan
Hapussaya kesulitan mengimplementasikan di java dengan tools netbeans, kira2 ada referensi mas?
BalasHapusmas ada referensi code yang di visual basic studio 2010?
BalasHapusbisa tidak diterapkan di php?
BalasHapusMohon maaf sebelumnya, Saya mau tanya kan naive bayes range nilainya kan dari 0-1, untuk yg program di atas ini knapa setiap sya coba untuk hasil prediksinya betul tetapi di perhitungannya saja yg kurang benar soalnya hasilnya lebih dari 1, gimana ya supaya perhitungannya bisa tepat soalnya udah saya coba ngitung di buku nggak sama hasilnya. Saya mohon bisa kah di koreksi lgi programnya pak. Terimakasih
BalasHapusMohon maaf sebelumnya, Saya mau tanya kan naive bayes range nilainya kan dari 0-1, untuk yg program di atas ini knapa setiap sya coba untuk hasil prediksinya betul tetapi di perhitungannya saja yg kurang benar soalnya hasilnya lebih dari 1, gimana ya supaya perhitungannya bisa tepat soalnya udah saya coba ngitung di buku nggak sama hasilnya. Saya mohon bisa kah di koreksi lgi programnya pak. Terimakasih
BalasHapusMas mau tanya itu database nya pake sql apa acces ya?
BalasHapusKomentar ini telah dihapus oleh pengarang.
BalasHapusselamat malam, pak kenapa source codenya tidak bisa didonwload ya ??
BalasHapushttps://www.4shared.com/rar/EqqPkcjuei/Predeksi_Kelulusan_dgn_Naive_B.html
BalasHapushttps://www.4shared.com/office/VYvXdrukfi/Naive_Bayes_Implemantasi.html
BalasHapushttps://www.4shared.com/rar/SflbJoyIgm/Predeksi_Kelulusan_dgn_Naive_B.html
BalasHapus