source code mining data poso

59
Source Code *Module 1 Option Explicit Public an As New ADODB.Connection Public db As New ADODB.Connection Public cs As New ADODB.Recordset Public oz As New ADODB.Recordset Public cs1 As New ADODB.Recordset Public cs2 As New ADODB.Recordset Public cso As New ADODB.Recordset Public csp As New ADODB.Recordset Public csq As New ADODB.Recordset Public csr As New ADODB.Recordset *Module 2 Public Function bukakoneksiDb() As Boolean On Error GoTo Salah bukakoneksiDb = False Set db = New ADODB.Connection db.CursorLocation = adUseClient db.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=dbtelemarketingbank" bukakoneksiDb = True frmMenu.Show Exit Function Salah: MsgBox Err.Description & Err.Number End Function Public Sub Ketengah(ByVal Frm As Form) Frm.Left = (frmMenu.Width - Frm.Width) / 2 Frm.Top = (frmMenu.Height - Frm.Height) / 2 - 500 End Sub Public Function GetFileSize(File As Variant) As String On Error Resume Next Dim Bytes As Long Const Kb As Long = 1024 Const Mb As Long = 1024 * Kb Const Gb As Long = 1024 * Mb Bytes = FileLen(File) If Bytes < Kb Then GetFileSize = Format(Bytes) & " bytes" ElseIf Bytes < Mb Then GetFileSize = Format(Bytes / Kb, "0.00") & " Kb" ElseIf Bytes < Gb Then GetFileSize = Format(Bytes / Mb, "0.00") & " Mb" Else GetFileSize = Format(Bytes / Gb, "0.00") & " Gb" End If

Upload: nizar-gremory

Post on 25-Sep-2015

12 views

Category:

Documents


1 download

DESCRIPTION

podol

TRANSCRIPT

  • Source Code *Module 1 Option Explicit Public an As New ADODB.Connection Public db As New ADODB.Connection Public cs As New ADODB.Recordset Public oz As New ADODB.Recordset Public cs1 As New ADODB.Recordset Public cs2 As New ADODB.Recordset Public cso As New ADODB.Recordset Public csp As New ADODB.Recordset Public csq As New ADODB.Recordset Public csr As New ADODB.Recordset *Module 2 Public Function bukakoneksiDb() As Boolean On Error GoTo Salah bukakoneksiDb = False Set db = New ADODB.Connection db.CursorLocation = adUseClient db.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=dbtelemarketingbank" bukakoneksiDb = True frmMenu.Show Exit Function Salah: MsgBox Err.Description & Err.Number End Function Public Sub Ketengah(ByVal Frm As Form) Frm.Left = (frmMenu.Width - Frm.Width) / 2 Frm.Top = (frmMenu.Height - Frm.Height) / 2 - 500 End Sub Public Function GetFileSize(File As Variant) As String On Error Resume Next Dim Bytes As Long Const Kb As Long = 1024 Const Mb As Long = 1024 * Kb Const Gb As Long = 1024 * Mb Bytes = FileLen(File) If Bytes < Kb Then GetFileSize = Format(Bytes) & " bytes" ElseIf Bytes < Mb Then GetFileSize = Format(Bytes / Kb, "0.00") & " Kb" ElseIf Bytes < Gb Then GetFileSize = Format(Bytes / Mb, "0.00") & " Mb" Else GetFileSize = Format(Bytes / Gb, "0.00") & " Gb" End If

  • End Function Function StripPath(nPath As String) As String If Right(nPath, 1) = "\" Then StripPath = nPath Else StripPath = nPath & "\" End If End Function Function Closedb() Dim Form As Form For Each Form In Forms Unload Form Set Form = Nothing 'Bersihkan memori yang digunakan sebelumnya Next Form Set xdb = Nothing 'close connecting End Function Public Sub Fokus(ByVal KotakTesk As TextBox) With KotakTesk .SelStart = 0 .Enabled = True .Locked = False .SelLength = Len(.Text) .SetFocus End With End Sub *Form Login Option Explicit Dim skinpath As String Dim efek As Integer Private Const WS_EX_LAYERED = &H80000 Private Const GWL_EXSTYLE = (-20) Private Const LWA_COLORKEY = &H1 Private Const LWA_ALPHA = &H2 Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crColor As Long, ByVal nAlpha As Byte, ByVal dwFlags As Long) As Long Private s, z As Integer

  • Public LoginSucceeded As Boolean Private Sub cmdCancel_Click() 'set the global var to false 'to denote a failed login LoginSucceeded = False Me.Hide End Sub Private Sub cmdEnd_Click() End End Sub Private Sub Form_Load() skinpath = App.Path & "\galaxy.skn" skn.LoadSkin skinpath skn.ApplySkin Me.hwnd Call SetWindowLong(Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED) Call SetLayeredWindowAttributes(Me.hwnd, RGB(255, 235, 255), 235, LWA_ALPHA Or LWA_COLORKEY) End Sub Private Sub RudieButton1_Click() 'check for correct password If txtPassword = "gelar" And txtUserName = "aoy" Then Screen.MousePointer = vbNormal Me.WindowState = 0 Do Me.Left = Me.Left + 20 Me.Move Me.Left, Me.Top DoEvents Loop Until Me.Left > Screen.Width frmMenu.Show frmMenu.TxtStatus.Text = "Nama : " & ("Gelar Nurcahya") & vbCrLf & _ "NPM : " & ("0607066") & vbCrLf & _ "Judul TA : " & ("Analisis dan Implementasi Decision Tree untuk Klasifikasi Data Konsumen Telemarketing untuk Deposito pada Bank Menggunakan Algoritma C4.5") & vbCrLf & _ "Status : " & ("Admin") MsgBox "anda sudah masuk ke menu utama", , "Pesan utama" 'place code to here to pass the 'success to the calling sub 'setting a global var is the easiest LoginSucceeded = True Me.Hide txtPassword = "" txtUserName = "" Else MsgBox "Password atau User name salah, silahkan coba lagi!!", , "Login" txtPassword.SetFocus

  • txtPassword = "" txtUserName = "" End If End Sub Private Sub RudieButton2_Click() txtUserName.Text = "" txtPassword.Text = "" End Sub Private Sub RudieButton3_Click() End End Sub Private Sub Timer1_Timer() s = s + 1 Me.Caption = Mid(".::*Login*::.", 1, s) If s = 15 Then Me.Caption = "" s = 0 End If End Sub Private Sub Timer2_Timer() z = z + 1 Label9.Caption = Mid("Gelar Nurcahya 2012", 1, z) If z = 22 Then Label9.Caption = "" z = 0 End If End Sub *Form Menu Private s, b As Integer Private Const WS_EX_LAYERED = &H80000 Private Const GWL_EXSTYLE = (-20) Private Const LWA_COLORKEY = &H1 Private Const LWA_ALPHA = &H2 Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crColor As Long, ByVal nAlpha As Byte, ByVal dwFlags As Long) As Long

  • Private Sub cmdStop_Click() If cmdStop.Caption = "Stop" Then cmdStop.Caption = "Start" Timer5.Enabled = False Else cmdStop.Caption = "Stop" Timer5.Enabled = True End If End Sub Private Sub Form_Load() Dim skinpath As String skinpath = App.Path & "\galaxy.skn" skn.LoadSkin skinpath skn.ApplySkin Me.hwnd Call SetWindowLong(Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED) Call SetLayeredWindowAttributes(Me.hwnd, RGB(255, 235, 255), 235, LWA_ALPHA Or LWA_COLORKEY) Call bukakoneksiDb Set oz = db.Execute("truncate table atribut") Set oz = db.Execute("truncate table klas_atribut") Set oz = db.Execute("truncate table hasil_proses") Set oz = db.Execute("truncate table test") Set oz = db.Execute("truncate table hitung") Set oz = db.Execute("truncate table entropy") Set oz = db.Execute("truncate table gain") Set oz = db.Execute("truncate table atribut_tree") Set oz = db.Execute("truncate table tree_klas_detail") Set oz = db.Execute("truncate table rules") Set oz = db.Execute("truncate table tree_parental_detail") Set oz = db.Execute("Select * From entropy") Set oz = db.Execute("truncate table hasil_proses") Set oz = db.Execute("truncate table hasil_test") Set oz = db.Execute("truncate table testperbandingan") Set oz = db.Execute("truncate table pre_gini") End Sub Private Sub mnAbout_Click() frmAbout.Show End Sub Private Sub mnDataMining_Click() frmDataMining.Show End Sub Private Sub mnDataTelemarketing_Click() frmDataTelemarketing.Show End Sub Private Sub mnLogOut_Click()

  • If MsgBox("Apakah Akan log out dari aplikasi? [Y/T] ?", vbYesNo + vbQuestion, "Pesan Keluar") = vbYes Then frmLogin.Show Me.Hide Else frmMenu.Show End If End Sub Private Sub mnMasterTest_Click() Set oz = db.Execute("select * from atribut_tree") If oz.RecordCount = 0 Then MsgBox ("Proses data mining belum dilakukan, silahkan masuk ke proses data mining"), , "Laporan" Else frmMasterUjiData.Show End If End Sub Private Sub mnPohonKeputusan_Click() Set oz = db.Execute("select * from atribut_tree") If oz.RecordCount = 0 Then MsgBox ("Proses data mining belum dilakukan, silahkan masuk ke proses data mining"), , "Laporan" Else frmTree.Show End If End Sub Private Sub mnRule_Click() Set oz = db.Execute("select * from rules") If oz.RecordCount = 0 Then MsgBox ("Proses data mining belum dilakukan, silahkan masuk ke proses data mining"), , "Laporan" Else frmRule.Show End If End Sub Private Sub mnUjiData_Click() Set oz = db.Execute("select * from atribut_tree") If oz.RecordCount = 0 Then MsgBox ("Proses data mining belum dilakukan, silahkan masuk ke proses data mining"), , "Laporan" Else frmUjiDataInput.Show End If End Sub Private Sub RudieButton3_Click() End Sub Private Sub Timer1_Timer() LblInfo.Caption = Right$(LblInfo.Caption, Len(LblInfo.Caption) - 1) & Left(LblInfo.Caption, 1) End Sub

  • Private Sub Timer2_Timer() s = s + 1 Me.Caption = Mid(".::*Menu*::.", 1, s) If s = 15 Then Me.Caption = "" s = 0 End If End Sub Private Sub Timer3_Timer() b = b + 1 Label9.Caption = Mid("Gelar Nurcahya 2012", 1, b) If b = 22 Then Label9.Caption = "" b = 0 End If End Sub Private Sub Timer4_Timer() lbl_tgl.Caption = Format(Date, "dd") lbl_tahun.Caption = Format(Date, "yyyy") lbl_bulan.Caption = Format(Date, "mmmm") End Sub Private Sub Timer5_Timer() lblwaktu.Caption = Format(Now, "DDDD, hh:mm:ss") End Sub *Form Data Telemarketing Private s, z As Integer Dim skinpath As String Private Const WS_EX_LAYERED = &H80000 Private Const GWL_EXSTYLE = (-20) Private Const LWA_COLORKEY = &H1 Private Const LWA_ALPHA = &H2 Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crColor As Long, ByVal nAlpha As Byte, ByVal dwFlags As Long) As Long Private Sub Form_Load() skinpath = App.Path & "\galaxy.skn" skn.LoadSkin skinpath skn.ApplySkin Me.hwnd Call SetWindowLong(Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED)

  • Call SetLayeredWindowAttributes(Me.hwnd, RGB(255, 235, 255), 235, LWA_ALPHA Or LWA_COLORKEY) Set oz = db.Execute("Select age, kredit, housing, loan,marital, education,contact, balance, duration,campaign,pdays,previous,poutcome, output From telemarketing") Set gridTelemarketing.DataSource = oz gridTelemarketing.ColWidth(0) = 500 gridTelemarketing.ColWidth(1) = 750 gridTelemarketing.ColWidth(2) = 750 gridTelemarketing.ColWidth(3) = 1000 gridTelemarketing.ColWidth(4) = 1000 gridTelemarketing.ColWidth(5) = 750 gridTelemarketing.ColWidth(6) = 750 gridTelemarketing.ColWidth(7) = 750 gridTelemarketing.ColWidth(8) = 1200 gridTelemarketing.ColWidth(9) = 1000 gridTelemarketing.ColWidth(10) = 1000 End Sub Private Sub RudieButton1_Click() Screen.MousePointer = vbNormal Me.WindowState = 0 Do Me.Left = Me.Left + 20 Me.Move Me.Left, Me.Top DoEvents Loop Until Me.Left > Screen.Width Unload Me End Sub Private Sub Timer1_Timer() s = s + 1 Me.Caption = Mid(".::*Data Telemarketing *::.", 1, s) If s = 30 Then Me.Caption = "" s = 0 End If End Sub Private Sub Timer2_Timer() z = z + 1 Label9.Caption = Mid("Gelar Nurcahya 2012", 1, z) If z = 22 Then Label9.Caption = "" z = 0 End If End Sub

  • *Form Data telemarketing Private s, z As Integer Dim skinpath As String Private Const WS_EX_LAYERED = &H80000 Private Const GWL_EXSTYLE = (-20) Private Const LWA_COLORKEY = &H1 Private Const LWA_ALPHA = &H2 Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crColor As Long, ByVal nAlpha As Byte, ByVal dwFlags As Long) As Long Public kodehitung, kodetree, NextNode As String Dim kodeatribut, kodeklasatribut As String Private Sub Form_Load() skinpath = App.Path & "\galaxy.skn" skn.LoadSkin skinpath skn.ApplySkin Me.hwnd Call SetWindowLong(Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED) Call SetLayeredWindowAttributes(Me.hwnd, RGB(255, 235, 255), 235, LWA_ALPHA Or LWA_COLORKEY) RudieButton2.Enabled = False Text2.Text = "" Text3.Text = "" Text4.Text = "" End Sub Function Ln(X) Ln = Log(X ^ X) / X End Function Sub refresh_cs() Set oz = db.Execute("Select * From entropy") Set gridEntropy.DataSource = oz gridEntropy.ColWidth(0) = 1000 gridEntropy.ColWidth(1) = 1000 gridEntropy.ColWidth(2) = 1000 gridEntropy.ColWidth(3) = 1000 gridEntropy.ColWidth(4) = 1000 gridEntropy.ColWidth(5) = 3000 End Sub Sub autokodehitung() Dim FormatNoUrut As String Set oz = db.Execute("Select * From hitung order by Node") FormatKodeHitung = "NODE" If oz.RecordCount = 0 Then kodehitung = FormatKodeHitung & "001"

  • Else Dim AmbilNo As String Dim Panjang As String Dim Nourut As String oz.MoveLast AmbilNo = Right(oz("Node"), 3) Panjang = AmbilNo + 1 Select Case Len(Panjang) Case 1: Nourut = "00" & Panjang Case 2: Nourut = "0" & Panjang Case 3: Nourut = Panjang End Select kodehitung = FormatKodeHitung & Nourut End If End Sub Sub autokodetree() Dim FormatNoUrut As String Set oz = db.Execute("Select * From atribut_tree order by Kode_Tree") FormatKodeTree = "TREE" If oz.RecordCount = 0 Then kodetree = FormatKodeTree & "001" Else Dim AmbilNo As String Dim Panjang As String Dim Nourut As String oz.MoveLast AmbilNo = Right(oz("Kode_Tree"), 3) Panjang = AmbilNo + 1 Select Case Len(Panjang) Case 1: Nourut = "00" & Panjang Case 2: Nourut = "0" & Panjang Case 3: Nourut = Panjang End Select kodetree = FormatKodeTree & Nourut End If End Sub Sub hitung(Level, VBarisPenentu, KondisiBarisPenentu, KondisiBarisPenentuSimpan, ExcludeAtribute) Dim JmlS, JmlS1, JmlS2, level_tree, i, j As Integer Dim Entropy, LonS1, LonS2, PengaliS1, PengaliS2, SubKali As Double Dim ArrayAtribut(), ArrayKlasAtributTree(), Node As String Dim EntropyBarisPenentu, Gain, PengurangGain As Double level_tree = Level 'mengisi row pertama tabel perhitungan "hitung" Call autokodehitung Set cs = db.Execute("select * from hitung") If cs.RecordCount = 0 Then Set cs = db.Execute("select count(*) from hasil_proses") JmlS = cs.Fields(0).Value Set cs = db.Execute("select count(*) from hasil_proses where output = 'Yes'")

  • JmlS1 = cs.Fields(0).Value Set cs = db.Execute("select count(*) from hasil_proses where output = 'No'") JmlS2 = cs.Fields(0).Value Else Set cs = db.Execute("select count(*) from hasil_proses where " & KondisiBarisPenentu & "") JmlS = cs.Fields(0).Value Set cs = db.Execute("select count(*) from hasil_proses where " & KondisiBarisPenentu & " and output = 'Yes'") JmlS1 = cs.Fields(0).Value Set cs = db.Execute("select count(*) from hasil_proses where " & KondisiBarisPenentu & " and output = 'No'") JmlS2 = cs.Fields(0).Value End If If JmlS1 = 0 Or JmlS2 = 0 Then Entropy = 0 Else If JmlS1 = JmlS2 Then Entropy = 1 Else If JmlS = 0 Then LonS1 = 0 LonS2 = 0 PengaliS1 = 0 PengaliS2 = 0 Else LonS1 = Ln(JmlS1 / JmlS) LonS2 = Ln(JmlS2 / JmlS) PengaliS1 = (JmlS1 / JmlS) PengaliS2 = (JmlS2 / JmlS) End If Entropy = ((-(PengaliS1)) * (LonS1 / Ln(2)) + ((-(PengaliS2)) * (LonS2 / Ln(2)))) End If End If 'Menyimpan Entropy Baris Penentu dan Jumlah Keseluruhan Baris Penentu Node = kodehitung BarisPenentu = VBarisPenentu EntropyBarisPenentu = Entropy SBarisPenentu = JmlS Set cs = db.Execute("INSERT INTO `hitung`(`Node`, `Level`, `Baris_Penentu`, `Kondisi_Baris_Penentu`, `S`, `S1`, `S2`, `Entropy`) VALUES ('" & Node & "', '" & level_tree & "', '" & VBarisPenentu & "','" & KondisiBarisPenentuSimpan & "','" & JmlS & "', '" & JmlS1 & "', '" & JmlS2 & "', '" & EntropyBarisPenentu & "')") 'mengambil kode atribut dan nama atribut dari tabel atribut Set cs1 = db.Execute("select * from atribut " & ExcludeAtribute & " order by Kode_Atribut") ReDim ArrayAtribut(0 To cs1.RecordCount - 1, 0 To 1) cs1.MoveFirst For i = 0 To cs1.RecordCount - 1 ArrayAtribut(i, 0) = cs1.Fields(0).Value 'oz![Kode_Atribut] ArrayAtribut(i, 1) = cs1.Fields(1).Value 'oz![Nama_Atribut] cs1.MoveNext

  • Next For i = 0 To cs1.RecordCount - 1 Gain = EntropyBarisPenentu Set cs2 = db.Execute("select * from klas_atribut where Kode_Atribut = '" & ArrayAtribut(i, 0) & "' order by Kode_Klas_Atribut") ReDim ArrayKlasAtribut(0 To cs2.RecordCount - 1, 0 To 1) 'Mengambil seluruh kode klas atribut dan nama klas atribut cs2.MoveFirst PengurangGain = 0 For j = 0 To cs2.RecordCount - 1 ArrayKlasAtribut(j, 0) = cs2.Fields(0).Value ArrayKlasAtribut(j, 1) = cs2.Fields(2).Value If KondisiBarisPenentu = "" Then KondisiKlasAtribut = ArrayAtribut(i, 1) & "= '" & ArrayKlasAtribut(j, 1) & "'" Else KondisiKlasAtribut = KondisiBarisPenentu & " And " & ArrayAtribut(i, 1) & "= '" & ArrayKlasAtribut(j, 1) & "'" End If 'Menghitung Entropy tiap Klas Atribut Set rs3 = db.Execute("select * from hasil_proses where " & KondisiKlasAtribut & " ") JmlS = rs3.RecordCount Set rs3 = db.Execute("select * from hasil_proses where " & KondisiKlasAtribut & " and output = 'Yes'") JmlS1 = rs3.RecordCount Set rs3 = db.Execute("select * from hasil_proses where " & KondisiKlasAtribut & " and output = 'No'") JmlS2 = rs3.RecordCount If JmlS1 = 0 Or JmlS2 = 0 Then Entropy = 0 Else If JmlS1 = JmlS2 Then Entropy = 1 Else If JmlS = 0 Then LonS1 = 0 LonS2 = 0 PengaliS1 = 0 PengaliS2 = 0 Else LonS1 = Ln(JmlS1 / JmlS) LonS2 = Ln(JmlS2 / JmlS) PengaliS1 = (JmlS1 / JmlS) PengaliS2 = (JmlS2 / JmlS) End If Entropy = ((-(PengaliS1)) * (LonS1 / Ln(2)) + ((-(PengaliS2)) * (LonS2 / Ln(2)))) End If End If 'Menyimpan Hasil Perhitungan Entropy Ke Dalam Tabel Entropy

  • Set rs3 = db.Execute("INSERT INTO `entropy`(`Node`, `Kode_Klas_Atribut`, `S`, `S1`, `S2`, `Entropy`)VALUES ('" & Node & "', '" & ArrayKlasAtribut(j, 0) & "', '" & JmlS & "', '" & JmlS1 & "', '" & JmlS2 & "', '" & Entropy & "')") 'Menghitung Pengurang Gain If JmlS = 0 Or SBarisPenentu = 0 Then SubKali = 0 Else SubKali = (JmlS / SBarisPenentu) End If PengurangGain = PengurangGain + (SubKali * Entropy) cs2.MoveNext Next 'Menghitung Gain Gain = Gain - PengurangGain Set cs2 = db.Execute("INSERT INTO `gain`(`Node`, `Level`, `Kode_Atribut`, `Gain`) VALUES ('" & Node & "', '" & level_tree & "','" & ArrayAtribut(i, 0) & "','" & Gain & "')") Next End Sub Sub autokodeatribut() Dim FormatNoUrut As String Set csr = db.Execute("Select * From atribut order by Kode_Atribut") FormatKodeAtribut = "ATRIBUT" If csr.RecordCount = 0 Then kodeatribut = FormatKodeAtribut & "001" Else Dim AmbilNo As String Dim Panjang As String Dim Nourut As String csr.MoveLast AmbilNo = Right(csr("Kode_Atribut"), 3) Panjang = AmbilNo + 1 Select Case Len(Panjang) Case 1: Nourut = "00" & Panjang Case 2: Nourut = "0" & Panjang Case 3: Nourut = Panjang End Select kodeatribut = FormatKodeAtribut & Nourut End If End Sub

  • Sub autokodeklasatribut() Dim FormatNoUrut As String Set csr = db.Execute("Select * From klas_atribut order by Kode_Klas_Atribut") FormatKodeKlasAtribut = "KODEKLASATR" If csr.RecordCount = 0 Then kodeklasatribut = FormatKodeKlasAtribut & "001" Else Dim AmbilNo As String Dim Panjang As String Dim Nourut As String csr.MoveLast AmbilNo = Right(csr("Kode_Klas_Atribut"), 3) Panjang = AmbilNo + 1 Select Case Len(Panjang) Case 1: Nourut = "00" & Panjang Case 2: Nourut = "0" & Panjang Case 3: Nourut = Panjang End Select kodeklasatribut = FormatKodeKlasAtribut & Nourut End IF End Sub Private Sub RudieButton1_Click() Text5.Text = "" Text6.Text = " Dim ArrayNamaAtribut(0 To 13) As String Dim ArraySplit(0 To 13) As Double Dim ArrayA(), ArrayB(), ArrayC() As Double Dim Split, GiniLow, GiniHigh As Double 'Menghapus Semua Data dari atribut, klas_atribut, dan hasil_proses If Text1.Text = "" Then MsgBox "Anda Belum Menentukan Jumlah Data test Dan data uji", vbCritical, "Input Ulang" Text1.SetFocus Else Set oz = db.Execute("select * from atribut") If oz.RecordCount 0 Then confirmaction = MsgBox("pembentukan data sebelumnya akan DIHAPUS. LANJUTKAN?", vbOKCancel, "Konfirmasi Hapus Data") If confirmaction = 1 Then GoTo proses Else MsgBox ("hasil_proses proses dibatalkan") End If Else proses: Set oz = db.Execute("truncate table atribut") Set oz = db.Execute("truncate table klas_atribut")

  • Set oz = db.Execute("truncate table hasil_proses") Set oz = db.Execute("truncate table test") Set oz = db.Execute("truncate table pre_gini") statuspraproses = "Computing" ArrayNamaAtribut(0) = "age" ArrayNamaAtribut(1) = "kredit" ArrayNamaAtribut(2) = "housing" ArrayNamaAtribut(3) = "loan" ArrayNamaAtribut(4) = "marital" ArrayNamaAtribut(5) = "education" ArrayNamaAtribut(6) = "contact" ArrayNamaAtribut(7) = "balance" ArrayNamaAtribut(8) = "duration" ArrayNamaAtribut(9) = "campaign" ArrayNamaAtribut(10) = "pdays" ArrayNamaAtribut(11) = "previous" ArrayNamaAtribut(12) = "poutcome" ArrayNamaAtribut(13) = "job" Set oz = db.Execute("select * from telemarketing") oz.MoveFirst For i = 0 To Text1.Text - 1 Set cs1 = db.Execute("INSERT INTO `pre_gini`(`age`, `kredit`, `housing`, `loan`, `marital`, `education`, `contact`, `balance`, `duration`,`campaign`,`pdays`,`previous`,`poutcome`, `job`, `output`) VALUES ('" & oz.Fields(0).Value & "','" & oz.Fields(1).Value & "','" & oz.Fields(2).Value & "','" & oz.Fields(3).Value & "','" & oz.Fields(4).Value & "','" & oz.Fields(5).Value & "','" & oz.Fields(6).Value & "','" & oz.Fields(7).Value & "','" & oz.Fields(8).Value & "','" & oz.Fields(9).Value & "','" & oz.Fields(10).Value & "','" & oz.Fields(11).Value & "','" & oz.Fields(12).Value & "','" & oz.Fields(13).Value & "','" & oz.Fields(14).Value & "')") oz.MoveNext Next For j = 0 To 13 Set cs1 = db.Execute("select " & ArrayNamaAtribut(j) & " from pre_gini group by " & ArrayNamaAtribut(j) & " order by " & ArrayNamaAtribut(j) & "") If ArrayNamaAtribut(j) "kredit" And ArrayNamaAtribut(j) "housing" And ArrayNamaAtribut(j) "loan" And ArrayNamaAtribut(j) "marital" And ArrayNamaAtribut(j) "education" And ArrayNamaAtribut(j) "contact" And ArrayNamaAtribut(j) "poutcome" And ArrayNamaAtribut(j) "age" And ArrayNamaAtribut(j) "job" Then On Error Resume Next ReDim ArrayA(0 To cs1.RecordCount - 1, 0) cs1.MoveFirst For i = 0 To cs1.RecordCount - 1 ArrayA(i, 0) = cs1.Fields(0).Value cs1.MoveNext Next ReDim ArrayB(0 To cs1.RecordCount, 0) For i = 0 To cs1.RecordCount If i = 0 Then ArrayB(i, 0) = ArrayA(i, 0) Else

  • If i > 0 And i < cs1.RecordCount - 1 Then ArrayB(i, 0) = (ArrayA(i - 1, 0) + ArrayA(i, 0)) / 2 Else ArrayB(i, 0) = ArrayA(i - 1, 0) End If End If Next Set cs2 = db.Execute("select count(*) from pre_gini") jmltotaldata = cs2.Fields(0).Value ReDim ArrayC(0 To cs1.RecordCount) For i = 0 To cs1.RecordCount Set cs2 = db.Execute("select count(*) from pre_gini where " & ArrayNamaAtribut(j) & " '" & ArrayB(i, 0) & "' and output = '2'") jmlNoHigh = cs2.Fields(0).Value If jmlYesLow = 0 Or jmlTotalLow = 0 Then pgylow = 0 Else If jmlNoLow = 0 Or jmlTotalLow = 0 Then pgnlow = 0 Else pgylow = (jmlYesLow / jmlTotalLow) pgnlow = (jmlNoLow / jmlTotalLow) End If End If If jmlYesHigh = 0 Or jmlTotalHigh = 0 Then pgyhigh = 0 Else If jmlNoHigh = 0 Or jmlTotalHigh = 0 Then

  • pgnhigh = 0 Else pgyhigh = (jmlYesHigh / jmlTotalHigh) pgnhigh = (jmlNoHigh / jmlTotalHigh) End If End If GiniLow = 1 - (pgylow ^ 2) - (pgnlow ^ 2) GiniHigh = 1 - (pgyhigh ^ 2) - (pgnhigh ^ 2) If GiniLow = 0 Then pginilow = 0 Else If GiniHigh = 0 Then pginihigh = 0 Else If jmlTotalLow = 0 Then tplow = 0 Else If jmlTotalHigh = 0 Then tphigh = 0 Else tplow = (jmlTotalLow / jmltotaldata) tphigh = (jmlTotalHigh / jmltotaldata) pginilow = (tplow * GiniLow) pginihigh = (tphigh * GiniHigh) End If End If End If End If Gini = pginilow + pginihigh ArrayC(i) = Gini Next Split = ArrayC(0) IndexSplit = 0 For i = 0 To cs1.RecordCount If ArrayC(i) < Split Then Split = ArrayC(i) ArraySplit(j) = ArrayB(i, 0) End If Next End If Next For j = 0 To 13 Call autokodeatribut If ArrayNamaAtribut(j) "kredit" And ArrayNamaAtribut(j) "housing" And ArrayNamaAtribut(j) "loan" And ArrayNamaAtribut(j) "marital" And ArrayNamaAtribut(j) "education" And

  • ArrayNamaAtribut(j) "contact" And ArrayNamaAtribut(j) "poutcome" And ArrayNamaAtribut(j) "age" And ArrayNamaAtribut(j) "job" Then Set oz = db.Execute("INSERT INTO `atribut`(`Kode_Atribut`, `Nama_Atribut`, Split) VALUES ('" & kodeatribut & "','" & ArrayNamaAtribut(j) & "', '" & ArraySplit(j) & "')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','" & ArraySplit(j) & "')") Else If ArrayNamaAtribut(j) "kredit" And ArrayNamaAtribut(j) "housing" And ArrayNamaAtribut(j) "marital" And ArrayNamaAtribut(j) "education" And ArrayNamaAtribut(j) "contact" And ArrayNamaAtribut(j) "poutcome" And ArrayNamaAtribut(j) "age" And ArrayNamaAtribut(j) "job" Then Set oz = db.Execute("INSERT INTO `atribut`(`Kode_Atribut`, `Nama_Atribut`, Split) VALUES ('" & kodeatribut & "','" & ArrayNamaAtribut(j) & "', '0')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','yes')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','no')") Else If ArrayNamaAtribut(j) "housing" And ArrayNamaAtribut(j) "marital" And ArrayNamaAtribut(j) "education" And ArrayNamaAtribut(j) "contact" And ArrayNamaAtribut(j) "poutcome" And ArrayNamaAtribut(j) "age" And ArrayNamaAtribut(j) "job" Then Set oz = db.Execute("INSERT INTO `atribut`(`Kode_Atribut`, `Nama_Atribut`, Split) VALUES ('" & kodeatribut & "','" & ArrayNamaAtribut(j) & "', '0')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','yes')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','no')") Else If ArrayNamaAtribut(j) "marital" And ArrayNamaAtribut(j) "education" And ArrayNamaAtribut(j) "contact" And ArrayNamaAtribut(j) "poutcome" And ArrayNamaAtribut(j) "age" And ArrayNamaAtribut(j) "job" Then Set oz = db.Execute("INSERT INTO `atribut`(`Kode_Atribut`, `Nama_Atribut`, Split) VALUES ('" & kodeatribut & "','" & ArrayNamaAtribut(j) & "', '0')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','yes')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','no')") Else

  • If ArrayNamaAtribut(j) "education" And ArrayNamaAtribut(j) "contact" And ArrayNamaAtribut(j) "poutcome" And ArrayNamaAtribut(j) "age" And ArrayNamaAtribut(j) "job" Then Set oz = db.Execute("INSERT INTO `atribut`(`Kode_Atribut`, `Nama_Atribut`, Split) VALUES ('" & kodeatribut & "','" & ArrayNamaAtribut(j) & "', '0')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','married')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','single')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','divorced')") Else If ArrayNamaAtribut(j) "contact" And ArrayNamaAtribut(j) "poutcome" And ArrayNamaAtribut(j) "age" And ArrayNamaAtribut(j) "job" Then Set oz = db.Execute("INSERT INTO `atribut`(`Kode_Atribut`, `Nama_Atribut`, Split) VALUES ('" & kodeatribut & "','" & ArrayNamaAtribut(j) & "', '0')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','Primary')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','secondary')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','tertiary')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','unknown')") Else If ArrayNamaAtribut(j) "poutcome" And ArrayNamaAtribut(j) "age" And ArrayNamaAtribut(j) "job" Then Set oz = db.Execute("INSERT INTO `atribut`(`Kode_Atribut`, `Nama_Atribut`, Split) VALUES ('" & kodeatribut & "','" & ArrayNamaAtribut(j) & "', '0')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','cellular')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','telephone')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','unknown')") Else If ArrayNamaAtribut(j) "age" And ArrayNamaAtribut(j) "job" Then Set oz = db.Execute("INSERT INTO `atribut`(`Kode_Atribut`, `Nama_Atribut`, Split) VALUES ('" & kodeatribut & "','" & ArrayNamaAtribut(j) & "', '0')") Call autokodeklasatribut

  • Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','other')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','failure')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','success')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','unknown')") Else If ArrayNamaAtribut(j) "job" Then Set oz = db.Execute("INSERT INTO `atribut`(`Kode_Atribut`, `Nama_Atribut`, Split) VALUES ('" & kodeatribut & "','" & ArrayNamaAtribut(j) & "', '0')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','child (=15 and =50)')") Else Set oz = db.Execute("INSERT INTO `atribut`(`Kode_Atribut`, `Nama_Atribut`, Split) VALUES ('" & kodeatribut & "','" & ArrayNamaAtribut(j) & "', '0')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','unemployed')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','services')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','management')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','retired')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','admin.')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','blue-collar')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','technician')") Call autokodeklasatribut

  • Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','self-employed')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','housemaid')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','entrepreneur')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','student')") Call autokodeklasatribut Set oz = db.Execute("INSERT INTO `klas_atribut`(`Kode_Klas_Atribut`, `Kode_Atribut`, `Klas_Atribut`) VALUES ('" & kodeklasatribut & "','" & kodeatribut & "','unknown')") End If End If End If End If End If End If End If End If End If Next Set cso = db.Execute("select * from telemarketing") jmltraining = (Text1.Text * (1 / 100)) * cso.RecordCount maxrowtraining = Math.Round(jmltraining, 0) Text2.Text = maxrowtraining If Text1.Text = 100 Then Text4.Text = maxrowtraining Else Text4.Text = cso.RecordCount - maxrowtraining End If cso.MoveFirst For j = 0 To cso.RecordCount - 1 isivalue = "" For k = 0 To 13 If ArrayNamaAtribut(k) "kredit" And ArrayNamaAtribut(k) "housing" And ArrayNamaAtribut(k) "loan" And ArrayNamaAtribut(k) "marital" And ArrayNamaAtribut(k) "education" And ArrayNamaAtribut(k) "contact" And ArrayNamaAtribut(k) "poutcome" And ArrayNamaAtribut(k) "age" And ArrayNamaAtribut(k) "job" Then If cso.Fields(k).Value
  • "contact" And ArrayNamaAtribut(k) "poutcome" And ArrayNamaAtribut(k) "age" And ArrayNamaAtribut(k) "job" Then If cso.Fields(k).Value = "yes" Then isivalue = isivalue & "'yes'" Else If cso.Fields(k).Value = "no" Then isivalue = isivalue & "'no'" End If End If Else If ArrayNamaAtribut(k) "housing" And ArrayNamaAtribut(k) "marital" And ArrayNamaAtribut(k) "education" And ArrayNamaAtribut(k) "contact" And ArrayNamaAtribut(k) "poutcome" And ArrayNamaAtribut(k) "age" And ArrayNamaAtribut(k) "job" Then If cso.Fields(k).Value = "yes" Then isivalue = isivalue & "'yes'" Else If cso.Fields(k).Value = "no" Then isivalue = isivalue & "'no'" End If End If Else If ArrayNamaAtribut(k) "marital" And ArrayNamaAtribut(k) "education" And ArrayNamaAtribut(k) "contact" And ArrayNamaAtribut(k) "poutcome" And ArrayNamaAtribut(k) "age" And ArrayNamaAtribut(k) "job" Then If cso.Fields(k).Value = "yes" Then isivalue = isivalue & "'yes'" Else If cso.Fields(k).Value = "no" Then isivalue = isivalue & "'no'" End If End If Else If ArrayNamaAtribut(k) "education" And ArrayNamaAtribut(k) "contact" And ArrayNamaAtribut(k) "poutcome" And ArrayNamaAtribut(k) "age" And ArrayNamaAtribut(k) "job" Then If cso.Fields(k).Value = "married" Then isivalue = isivalue & "'married'" Else If cso.Fields(k).Value = "single" Then isivalue = isivalue & "'single'" Else If cso.Fields(k).Value = "divorced" Then isivalue = isivalue & "'divorced'" End If End If End If Else If ArrayNamaAtribut(k) "contact" And ArrayNamaAtribut(k) "poutcome" And ArrayNamaAtribut(k) "age" And ArrayNamaAtribut(k) "job" Then If cso.Fields(k).Value = "primary" Then isivalue = isivalue & "'primary'"

  • Else If cso.Fields(k).Value = "secondary" Then isivalue = isivalue & "'secondary'" Else If cso.Fields(k).Value = "tertiary" Then isivalue = isivalue & "'tertiary'" Else If cso.Fields(k).Value = "unknown" Then isivalue = isivalue & "'unknown'" End If End If End If End If Else If ArrayNamaAtribut(k) "poutcome" And ArrayNamaAtribut(k) "age" And ArrayNamaAtribut(k) "job" Then If cso.Fields(k).Value = "cellular" Then isivalue = isivalue & "'cellular'" Else If cso.Fields(k).Value = "telephone" Then isivalue = isivalue & "'telephone'" Else If cso.Fields(k).Value = "unknown" Then isivalue = isivalue & "'unknown'" End If End If End If Else If ArrayNamaAtribut(k) "age" And ArrayNamaAtribut(k) "job" Then If cso.Fields(k).Value = "other" Then isivalue = isivalue & "'other'" Else If cso.Fields(k).Value = "failure" Then isivalue = isivalue & "'failure'" Else If cso.Fields(k).Value = "success" Then isivalue = isivalue & "'success'" Else If cso.Fields(k).Value = "unknown" Then isivalue = isivalue & "'unknown'" End If End If End If End If Else If ArrayNamaAtribut(k) "job" Then If cso.Fields(k).Value = 15) And (cso.Fields(k).Value
  • Else isivalue = isivalue & "'old (>=50)'" End If End If Else If cso.Fields(k).Value = "unemployed" Then isivalue = isivalue & "'unemployed'" Else If cso.Fields(k).Value = "services" Then isivalue = isivalue & "'services'" Else If cso.Fields(k).Value = "management" Then isivalue = isivalue & "'management'" Else If cso.Fields(k).Value = "retired" Then isivalue = isivalue & "'retired'" Else If cso.Fields(k).Value = "admin." Then isivalue = isivalue & "'admin.'" Else If cso.Fields(k).Value = "blue-collar" Then isivalue = isivalue & "'blue-collar'" Else If cso.Fields(k).Value = "technician" Then isivalue = isivalue & "'technician'" Else If cso.Fields(k).Value = "self-employed" Then isivalue = isivalue & "'self-employed'" Else If cso.Fields(k).Value = "housemaid" Then isivalue = isivalue & "'housemaid'" Else If cso.Fields(k).Value = "entrepreneur" Then isivalue = isivalue & "'entrepreneur'" Else If cso.Fields(k).Value = "student" Then isivalue = isivalue & "'student'" Else If cso.Fields(k).Value = "unknown" Then isivalue = isivalue & "'unknown'" End If End If End If End If End If End If End If End If End If End If End If

  • End If End If End If End If End If End If End If End If End If End If If k < 13 Then isivalue = isivalue & "," End If Next If cso.Fields(14).Value = 1 Then isivalue = isivalue & ",'Yes'" Else isivalue = isivalue & ",'No'" End If If maxrowtraining = cso.RecordCount Then Set csp = db.Execute("Insert into hasil_proses (age, kredit, housing, loan, marital,education,contact,balance,duration,campaign,pdays,previous,poutcome,job,output) Values(" & isivalue & ")") Set csp = db.Execute("Insert into test (age, kredit, housing, loan, marital,education,contact,balance,duration,campaign,pdays,previous,poutcome,job,output) Values(" & isivalue & ")") Else If j < maxrowtraining Then Set csp = db.Execute("Insert into hasil_proses (age, kredit, housing, loan, marital,education,contact,balance,duration,campaign,pdays,previous,poutcome,job,output) Values(" & isivalue & ")") Else Set csp = db.Execute("Insert into test (age, kredit, housing, loan, marital,education,contact,balance,duration,campaign,pdays,previous,poutcome,job,output) Values(" & isivalue & ")") End If End If cso.MoveNext Next Set oz = db.Execute("Select * From hasil_proses") Set gridPra.DataSource = oz gridPra.ColWidth(0) = 500 gridPra.ColWidth(1) = 2500 gridPra.ColWidth(2) = 1000 gridPra.ColWidth(3) = 1000 gridPra.ColWidth(4) = 1000 gridPra.ColWidth(5) = 1000

  • gridPra.ColWidth(6) = 750 gridPra.ColWidth(7) = 750 gridPra.ColWidth(8) = 1000 gridPra.ColWidth(9) = 750 gridPra.ColWidth(10) = 1000 statuspraproses = "Done" If statuspraproses = "Done" Then MsgBox ("Proses gini, atribut, sudah selesai dilaksanakan") End If RudieButton2.Enabled = True If statuspraproses = "Done" Then Text5.Text = ("Done") End If If Text1.Text = 0 Then Text5.Text = ("Failure") End If End If End If End Sub Private Sub RudieButton2_Click() Dim Level, i, j, jmlbaris, jmlkodetree As Integer Dim VBarisPenentu, ArrayKlasAtribut(), kal, ArrayKodeBarisPenentu(), ArrayRoot(), KondisiBarisPenentu, ExcludeAtribute, ArrayTreeAtribut(), AtributNode As String Dim maxgain As Double Set oz = db.Execute("select * from hitung") If oz.RecordCount 0 Then confirmaction = MsgBox("Pembentukan pohon keputusan sebelumnya akan DIHAPUS. LANJUTKAN?", vbOKCancel, "Konfirmasi Hapus Data") If confirmaction = 1 Then GoTo proses End If Else proses: treesolved = "False" Set oz = db.Execute("truncate table hitung") Set oz = db.Execute("truncate table entropy") Set oz = db.Execute("truncate table gain") Set oz = db.Execute("truncate table atribut_tree") Set oz = db.Execute("truncate table tree_klas_detail") Set oz = db.Execute("truncate table rules") Set oz = db.Execute("truncate table tree_parental_detail") 'Tahapan Apabila Tabel Tree Masih Kosong Level = 0 VBarisPenentu = "TOTAL" KondisiBarisPenentu = "" KondisiBarisPenentuSimpan = "TOTAL" ExcludeAtribute = "" Call hitung(Level, VBarisPenentu, KondisiBarisPenentu, KondisiBarisPenentuSimpan, ExcludeAtribute)

  • KodeBarisPenentu = kodehitung 'Membuat dan Menyimpan Row Pertama Pada Tabel Tree Atribut Set csq = db.Execute("Select Kode_Atribut from gain join(SELECT Max(Gain) as maxgain FROM `gain` where Node = '" & kodehitung & "') as a on gain.Gain = a.maxgain") AtributNode = csq.Fields(0).Value Call autokodetree Parent = kodetree Set oz = db.Execute("INSERT INTO `atribut_tree`(`Kode_Tree`, `Level`, `Kode_Atribut`) VALUES ('" & kodetree & "','" & Level & "','" & AtributNode & "')") 'Menentukan Leaf Dari Node Pertama Set oz = db.Execute("select Kode_Atribut from atribut_tree where Kode_Tree = 'TREE001'") AtributNode = oz.Fields(0).Value Set oz = db.Execute("Select * from klas_atribut where Kode_Atribut = '" & AtributNode & "' order by Kode_Klas_Atribut") 'KodeKlasAtribut = oz.Fields(0).Value jmlchild = 1 Level = 1 ReDim ArrayKlasAtribut(0 To oz.RecordCount - 1, 0) oz.MoveFirst For i = 0 To oz.RecordCount - 1 ArrayKlasAtribut(i, 0) = oz.Fields(0).Value oz.MoveNext Next For i = 0 To oz.RecordCount - 1 'kal = "" kodeklasatribut = ArrayKlasAtribut(i, 0) Set cso = db.Execute("select S1, S2, Entropy from entropy where Node = '" & KodeBarisPenentu & "' and Kode_Klas_Atribut = '" & ArrayKlasAtribut(i, 0) & "'") If cso!s1 = 0 Then Result = "No" Else If cso!s2 = 0 Then Result = "Yes" Else Result = "Next" End If End If If Result = "Next" Then Call autokodetree NewChild = kodetree

  • NextNode = NewChild Set csp = db.Execute("INSERT INTO `tree_klas_detail`(`Kode_Tree`, `Kode_Klas_atribut`, `Result`, `Child`) VALUES ('" & Parent & "', '" & kodeklasatribut & "', '" & Result & "', '" & NewChild & "')") Set csp = db.Execute("INSERT INTO `tree_parental_detail`(`Parent`, `Urutan_Child`, `Child`) VALUES ('" & Parent & "', '" & jmlchild & "','" & NewChild & "')") Set csp = db.Execute("INSERT INTO `atribut_tree`(`Kode_Tree`, `Level`, `Kode_Atribut`) VALUES ('" & NewChild & "','" & Level & "','NULL')") 'Ambil root jmlbaris = 0 nextroot = "true" Do Set csq = db.Execute("select a.Kode_Tree, a.Level, b.Nama_Atribut, b.Klas_Atribut from((Select tree_klas_detail.*, atribut_tree.Level from tree_klas_detail join atribut_tree on tree_klas_detail.Child = atribut_tree.Kode_Tree) as a Join(select klas_atribut.Kode_Klas_Atribut, klas_atribut.Klas_Atribut, atribut.Nama_Atribut from klas_atribut join atribut on klas_atribut.Kode_Atribut = Atribut.Kode_Atribut) as b on a.Kode_Klas_Atribut = b.Kode_Klas_Atribut) where a. Child = '" & NextNode & "' ") jmlbaris = jmlbaris + 1 If csq.Fields(1).Value = 1 Then nextroot = "False" Else NextNode = csq.Fields(0).Value End If Loop While nextroot = "true" ReDim ArrayRoot(0 To jmlbaris - 1, 0 To 1) NextNode = NewChild For j = 0 To jmlbaris - 1 Set csq = db.Execute("select a.Kode_Tree, a.Level, b.Nama_Atribut, b.Klas_Atribut from((Select tree_klas_detail.*, atribut_tree.Level from tree_klas_detail join atribut_tree on tree_klas_detail.Child = atribut_tree.Kode_Tree) as a Join(select klas_atribut.Kode_Klas_Atribut, klas_atribut.Klas_Atribut, atribut.Nama_Atribut from klas_atribut join atribut on klas_atribut.Kode_Atribut = Atribut.Kode_Atribut) as b on a.Kode_Klas_Atribut = b.Kode_Klas_Atribut) where a. Child = '" & NextNode & "' ") ArrayRoot(j, 0) = csq.Fields(2).Value ArrayRoot(j, 1) = csq.Fields(3).Value NextNode = csq.Fields(0).Value Next KondisiBarisPenentu = "" KondisiBarisPenentuSimpan = "" ExcludeAtribute = "where Nama_Atribut Not In(" j = jmlbaris - 1 Do KondisiBarisPenentu = KondisiBarisPenentu & ArrayRoot(j, 0) & "=" & "'" & ArrayRoot(j, 1) & "'" KondisiBarisPenentuSimpan = KondisiBarisPenentuSimpan & ArrayRoot(j, 0) & "=" & "" & ArrayRoot(j, 1) & ""

  • ExcludeAtribute = ExcludeAtribute & "'" & ArrayRoot(j, 0) & "'" If j > 0 Then KondisiBarisPenentu = KondisiBarisPenentu & " And " KondisiBarisPenentuSimpan = KondisiBarisPenentuSimpan & " And " ExcludeAtribute = ExcludeAtribute & "," End If j = j - 1 Loop While j >= 0 ExcludeAtribute = ExcludeAtribute & ")" VBarisPenentu = NewChild Call hitung(Level, VBarisPenentu, KondisiBarisPenentu, KondisiBarisPenentuSimpan, ExcludeAtribute) NodeBaru = kodehitung Set csq = db.Execute("Select Kode_Atribut from gain join(SELECT Max(Gain) as maxgain FROM `gain` where Node = '" & NodeBaru & "') as a on gain.Gain = a.maxgain ") AtributNode = csq!Kode_Atribut Set csq = db.Execute("UPDATE `atribut_tree` SET `Kode_Atribut`= '" & AtributNode & "' WHERE Kode_Tree = '" & NewChild & "'") Else Set csp = db.Execute("INSERT INTO `tree_klas_detail`(`Kode_Tree`, `Kode_Klas_atribut`, `Result`, `Child`) VALUES ('" & Parent & "', '" & kodeklasatribut & "', '" & Result & "', 'NULL')") End If jmlchild = jmlchild + 1 Next LevelKerja = 1 Do NextLevel = "False" Set oz = db.Execute("select * from atribut_tree where Level = '" & LevelKerja & "'") If oz.RecordCount = 0 Then NextLevel = "False" Else jmlkodetree = oz.RecordCount - 1 ReDim ArrayTreeAtribut(0 To jmlkodetree, 0) oz.MoveFirst For i = 0 To oz.RecordCount - 1 ArrayTreeAtribut(i, 0) = oz.Fields(0).Value oz.MoveNext Next

  • For k = 0 To jmlkodetree Set csr = db.Execute("select * from hitung where Baris_Penentu = '" & ArrayTreeAtribut(k, 0) & "'") KodeBarisPenentu = csr!Node Parent = ArrayTreeAtribut(k, 0) Set oz = db.Execute("select Kode_Atribut from atribut_tree where Kode_Tree = '" & ArrayTreeAtribut(k, 0) & "' ") AtributNode = oz.Fields(0).Value Set oz = db.Execute("Select * from klas_atribut where Kode_Atribut = '" & AtributNode & "' order by Kode_Klas_Atribut") 'KodeKlasAtribut = oz.Fields(0).Value jmlchild = 1 Level = LevelKerja + 1 ReDim ArrayKlasAtribut(0 To oz.RecordCount - 1, 0) oz.MoveFirst For i = 0 To oz.RecordCount - 1 ArrayKlasAtribut(i, 0) = oz.Fields(0).Value oz.MoveNext Next For i = 0 To oz.RecordCount - 1 'kal = "" 'Result = "NULL" kodeklasatribut = ArrayKlasAtribut(i, 0) Set cso = db.Execute("select S1, S2, Entropy from entropy where Node = '" & KodeBarisPenentu & "' and Kode_Klas_Atribut = '" & ArrayKlasAtribut(i, 0) & "'") If cso!s1 = 0 And cso!s2 = 0 Then Result = "UNCLASSIFIED" Else If cso!s2 = 0 And cso!s1 0 Then Result = "Yes" Else If cso!s1 = 0 And cso!s2 0 Then Result = "No" Else Result = "Next" End If End If End If If LevelKerja < 8 Then If Result = "Next" Then NextLevel = "True" Call autokodetree NewChild = kodetree

  • NextNode = NewChild Set csp = db.Execute("INSERT INTO `tree_klas_detail`(`Kode_Tree`, `Kode_Klas_atribut`, `Result`, `Child`) VALUES ('" & Parent & "', '" & kodeklasatribut & "', '" & Result & "', '" & NewChild & "')") Set csp = db.Execute("INSERT INTO `tree_parental_detail`(`Parent`, `Urutan_Child`, `Child`) VALUES ('" & Parent & "', '" & jmlchild & "','" & NewChild & "')") Set csp = db.Execute("INSERT INTO `atribut_tree`(`Kode_Tree`, `Level`, `Kode_Atribut`) VALUES ('" & NewChild & "','" & Level & "','NULL')") 'Ambil root jmlbaris = 0 nextroot = "true" Do Set csq = db.Execute("select a.Kode_Tree, a.Level, b.Nama_Atribut, b.Klas_Atribut from((Select tree_klas_detail.*, atribut_tree.Level from tree_klas_detail join atribut_tree on tree_klas_detail.Child = atribut_tree.Kode_Tree) as a Join(select klas_atribut.Kode_Klas_Atribut, klas_atribut.Klas_Atribut, atribut.Nama_Atribut from klas_atribut join atribut on klas_atribut.Kode_Atribut = Atribut.Kode_Atribut) as b on a.Kode_Klas_Atribut = b.Kode_Klas_Atribut) where a. Child = '" & NextNode & "' ") jmlbaris = jmlbaris + 1 If csq.Fields(1).Value = 1 Then nextroot = "False" Else NextNode = csq.Fields(0).Value End If 'NextNode = csq.Fields(0).Value Loop While nextroot = "true" 'csq.Fields(2).Value > 0 ReDim ArrayRoot(0 To jmlbaris - 1, 0 To 1) NextNode = NewChild For j = 0 To jmlbaris - 1 Set csq = db.Execute("select a.Kode_Tree, a.Level, b.Nama_Atribut, b.Klas_Atribut from((Select tree_klas_detail.*, atribut_tree.Level from tree_klas_detail join atribut_tree on tree_klas_detail.Child = atribut_tree.Kode_Tree) as a Join(select klas_atribut.Kode_Klas_Atribut, klas_atribut.Klas_Atribut, atribut.Nama_Atribut from klas_atribut join atribut on klas_atribut.Kode_Atribut = Atribut.Kode_Atribut) as b on a.Kode_Klas_Atribut = b.Kode_Klas_Atribut) where a. Child = '" & NextNode & "' ") ArrayRoot(j, 0) = csq.Fields(2).Value ArrayRoot(j, 1) = csq.Fields(3).Value NextNode = csq.Fields(0).Value Next For m = 0 To jmlbaris - 1 kal = "" For n = 0 To 1 kal = kal & ArrayRoot(m, n) & " " Next Next

  • KondisiBarisPenentu = "" KondisiBarisPenentuSimpan = "" ExcludeAtribute = "where Nama_Atribut Not In(" j = jmlbaris - 1 Do KondisiBarisPenentu = KondisiBarisPenentu & ArrayRoot(j, 0) & "=" & "'" & ArrayRoot(j, 1) & "'" KondisiBarisPenentuSimpan = KondisiBarisPenentuSimpan & ArrayRoot(j, 0) & "=" & "" & ArrayRoot(j, 1) & "" ExcludeAtribute = ExcludeAtribute & "'" & ArrayRoot(j, 0) & "'" If j > 0 Then KondisiBarisPenentu = KondisiBarisPenentu & " And " KondisiBarisPenentuSimpan = KondisiBarisPenentuSimpan & " And " ExcludeAtribute = ExcludeAtribute & "," End If j = j - 1 Loop While j >= 0 ExcludeAtribute = ExcludeAtribute & ")" VBarisPenentu = NewChild Call hitung(Level, VBarisPenentu, KondisiBarisPenentu, KondisiBarisPenentuSimpan, ExcludeAtribute) NodeBaru = kodehitung Set csq = db.Execute("Select max(Gain) from gain where Node = '" & NodeBaru & "' ") maxgain = csq.Fields(0).Value Set csq = db.Execute("Select * from gain where Node = '" & NodeBaru & "' and Gain = '" & maxgain & "'") jmlgaintertinggi = csq.RecordCount If jmlgaintertinggi > 1 Then csq.MoveFirst AtributNode = csq!Kode_Atribut Else Set csq = db.Execute("Select Kode_Atribut from gain join(SELECT Max(Gain) as maxgain FROM `gain` where Node = '" & NodeBaru & "') as a on gain.Gain = a.maxgain where gain.Node = '" & NodeBaru & "' and gain.Gain = a.maxgain ") AtributNode = csq.Fields(0).Value End If Set csq = db.Execute("UPDATE `atribut_tree` SET `Kode_Atribut`= '" & AtributNode & "' WHERE Kode_Tree = '" & NewChild & "'") Else Set csp = db.Execute("INSERT INTO `tree_klas_detail`(`Kode_Tree`, `Kode_Klas_atribut`, `Result`, `Child`) VALUES ('" & Parent & "', '" & kodeklasatribut & "', '" & Result & "', 'NULL')")

  • End If Else If Result = "Next" Then Set csp = db.Execute("INSERT INTO `tree_klas_detail`(`Kode_Tree`, `Kode_Klas_atribut`, `Result`, `Child`) VALUES ('" & Parent & "', '" & kodeklasatribut & "', '" & Result & "', 'UNCLASSIFIED')") Else Set csp = db.Execute("INSERT INTO `tree_klas_detail`(`Kode_Tree`, `Kode_Klas_atribut`, `Result`, `Child`) VALUES ('" & Parent & "', '" & kodeklasatribut & "', '" & Result & "', 'NULL')") End If End If jmlchild = jmlchild + 1 Next Next LevelKerja = LevelKerja + 1 If LevelKerja > 8 Then NextLevel = "False" End If End If Loop While NextLevel = "True" Set oz = db.Execute("truncate table rules") Set oz = db.Execute("SELECT * FROM `tree_klas_detail` where result 'Next' or Child = 'UNCLASSIFIED'") oz.MoveFirst For A = 0 To oz.RecordCount - 1 If oz.Fields(0).Value = "TREE001" Then Set cs1 = db.Execute("select b.Nama_Atribut, a.Klas_Atribut from((select * from klas_atribut where Kode_Klas_Atribut = '" & oz.Fields(1).Value & "' )as a join (select * from atribut) as b on a.Kode_Atribut = b.Kode_Atribut)") KondisiBarisPenentu = "" & cs1.Fields(0) & " = " & cs1.Fields(1) & "" Set cs2 = db.Execute("INSERT INTO `rules`(`Rule`, `Hasil`) VALUES ('" & KondisiBarisPenentu & "','" & oz.Fields(2) & "')") Else NewChild = oz.Fields(0).Value NextNode = NewChild jmlbaris = 0 nextroot = "true" Do Set csq = db.Execute("select a.Kode_Tree, a.Level, b.Nama_Atribut, b.Klas_Atribut from((Select tree_klas_detail.*, atribut_tree.Level from tree_klas_detail join atribut_tree on tree_klas_detail.Child = atribut_tree.Kode_Tree) as a Join(select klas_atribut.Kode_Klas_Atribut, klas_atribut.Klas_Atribut, atribut.Nama_Atribut from klas_atribut join atribut on klas_atribut.Kode_Atribut = Atribut.Kode_Atribut) as b on a.Kode_Klas_Atribut = b.Kode_Klas_Atribut) where a. Child = '" & NextNode & "' ") jmlbaris = jmlbaris + 1 If csq.Fields(1).Value = 1 Then

  • nextroot = "False" Else NextNode = csq.Fields(0).Value End If Loop While nextroot = "true" ReDim ArrayRoot(0 To jmlbaris - 1, 0 To 1) NextNode = NewChild For j = 0 To jmlbaris - 1 Set csq = db.Execute("select a.Kode_Tree, a.Level, b.Nama_Atribut, b.Klas_Atribut from((Select tree_klas_detail.*, atribut_tree.Level from tree_klas_detail join atribut_tree on tree_klas_detail.Child = atribut_tree.Kode_Tree) as a Join(select klas_atribut.Kode_Klas_Atribut, klas_atribut.Klas_Atribut, atribut.Nama_Atribut from klas_atribut join atribut on klas_atribut.Kode_Atribut = Atribut.Kode_Atribut) as b on a.Kode_Klas_Atribut = b.Kode_Klas_Atribut) where a. Child = '" & NextNode & "' ") ArrayRoot(j, 0) = csq.Fields(2).Value ArrayRoot(j, 1) = csq.Fields(3).Value NextNode = csq.Fields(0).Value Next For m = 0 To jmlbaris - 1 kal = "" For n = 0 To 1 kal = kal & ArrayRoot(m, n) & " " Next Next KondisiBarisPenentu = "" ExcludeAtribute = "where Nama_Atribut Not In(" j = jmlbaris - 1 Do KondisiBarisPenentu = KondisiBarisPenentu & ArrayRoot(j, 0) & "=" & "" & ArrayRoot(j, 1) & "" ExcludeAtribute = ExcludeAtribute & "'" & ArrayRoot(j, 0) & "'" If j > 0 Then KondisiBarisPenentu = KondisiBarisPenentu & " And " ExcludeAtribute = ExcludeAtribute & "," End If j = j - 1 Loop While j >= 0 Set cs1 = db.Execute("select d.Nama_Atribut, c.Klas_Atribut from(select a.Kode_Klas_Atribut, b.Klas_Atribut, b.Kode_Atribut from(SELECT * FROM `tree_klas_detail` ) as a join (select * from klas_atribut where Kode_Klas_Atribut = '" & oz.Fields(1).Value & "') as b on a.Kode_Klas_Atribut = b.Kode_Klas_Atribut) as c join (select * from atribut)as d on c.KOde_Atribut = d.Kode_Atribut") KondisiBarisPenentu = KondisiBarisPenentu & " And " & cs1.Fields(0).Value & "=" & cs1.Fields(1).Value ExcludeAtribute = ExcludeAtribute & ")" If oz.Fields(2).Value "Next" Then

  • Set cs2 = db.Execute("INSERT INTO `rules`(`Rule`, `Hasil`) VALUES ('" & KondisiBarisPenentu & "','" & oz.Fields(2) & "')") Else Set cs2 = db.Execute("INSERT INTO `rules`(`Rule`, `Hasil`) VALUES ('" & KondisiBarisPenentu & "','" & oz.Fields(3) & "')") End If End If oz.MoveNext Next treesolved = "True" If treesolved = "True" Then MsgBox ("Proses Pembentukan Pohon Keputusan dan Rule Selesai") End If If treesolved = "True" Then Text6.Text = ("Done") End If If Text1.Text = 0 Then Text6.Text = ("Failure") End If Set oz = db.Execute("select * from atribut_tree") If oz.RecordCount = 0 Then MsgBox "Pohon keputusan dan Rule Tidak Terbentuk Karena Data Tidak Cukup Untuk Menghasilkan Pola", vbCritical Else End If End If End Sub Private Sub RudieButton3_Click() frmDataTelemarketing.Show End Sub Private Sub RudieButton4_Click() Screen.MousePointer = vbNormal Me.WindowState = 0 Do Me.Left = Me.Left + 20 Me.Move Me.Left, Me.Top DoEvents Loop Until Me.Left > Screen.Width Unload Me End Sub

  • Private Sub Text1_Change() 'PRESENTASE DATA LATIH If Text1.Text "" Then On Error Resume Next If Not IsNumeric(Text1.Text) Then MsgBox "bagian ini harus diisi angka", vbCritical, "Input Salah" Text1.Text = "" Else If Text1.Text
  • End If End Sub *Form Rule Private s, z As Integer Dim skinpath As String Private Const WS_EX_LAYERED = &H80000 Private Const GWL_EXSTYLE = (-20) Private Const LWA_COLORKEY = &H1 Private Const LWA_ALPHA = &H2 Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crColor As Long, ByVal nAlpha As Byte, ByVal dwFlags As Long) As Long Private Sub Form_Load() skinpath = App.Path & "\galaxy.skn" skn.LoadSkin skinpath skn.ApplySkin Me.hwnd Call SetWindowLong(Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED) Call SetLayeredWindowAttributes(Me.hwnd, RGB(255, 235, 255), 235, LWA_ALPHA Or LWA_COLORKEY) Set rs3 = db.Execute("select * from rules") Set gridrules.DataSource = rs3 gridrules.ColWidth(0) = 17000 gridrules.ColWidth(1) = 1500 End Sub Private Sub RudieButton1_Click() Screen.MousePointer = vbNormal Me.WindowState = 0 Do Me.Left = Me.Left + 20 Me.Move Me.Left, Me.Top DoEvents Loop Until Me.Left > Screen.Width Unload Me End Sub Private Sub Timer1_Timer() s = s + 1 Me.Caption = Mid(".::*Rule*::.", 1, s) If s = 15 Then Me.Caption = "" s = 0

  • End If End Sub Private Sub Timer2_Timer() z = z + 1 Label9.Caption = Mid("Gelar Nurcahya 2012", 1, z) If z = 22 Then Label9.Caption = "" z = 0 End If End Sub *Form Tree Private s, z As Integer Dim skinpath As String Private Const WS_EX_LAYERED = &H80000 Private Const GWL_EXSTYLE = (-20) Private Const LWA_COLORKEY = &H1 Private Const LWA_ALPHA = &H2 Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crColor As Long, ByVal nAlpha As Byte, ByVal dwFlags As Long) As Long 'Pohon Keputusan Private Sub Form_Load() skinpath = App.Path & "\galaxy.skn" skn.LoadSkin skinpath skn.ApplySkin Me.hwnd Call SetWindowLong(Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED) Call SetLayeredWindowAttributes(Me.hwnd, RGB(255, 235, 255), 235, LWA_ALPHA Or LWA_COLORKEY) Dim nodx As Node Dim ArrayKodeTree() As String Set nodx = TreeView1.Nodes.Add(, , "TREE001", "Rules") nodx.Expanded = True jmlclassified = 1 jmlunclassified = 1 Set oz = db.Execute("select max(Level) from atribut_tree") For i = 0 To oz.Fields(0).Value '- 1

  • Set oz = db.Execute("select Kode_Tree from atribut_tree where Level = '" & i & "'") ReDim ArrayKodeTree(0 To oz.RecordCount - 1) oz.MoveFirst For j = 0 To oz.RecordCount - 1 ArrayKodeTree(j) = oz!Kode_Tree oz.MoveNext Next For j = 0 To oz.RecordCount - 1 If i = 0 Then Set cs1 = db.Execute("select e.Kode_Tree, e.Nama_Atribut, f.Klas_Atribut, f.Result, f.Child from (select a.Kode_Tree , b.Nama_Atribut from ((select * from atribut_tree) as a join (select * from atribut)as b on a.Kode_Atribut = b.Kode_Atribut) where a.level = '" & i & "' and Kode_Tree = '" & ArrayKodeTree(j) & "') as e join (select c.Kode_Tree, c.Result,c.Child, d.Klas_Atribut from(select * from tree_klas_detail )as c join(select * from klas_atribut) as d on c.Kode_Klas_Atribut = d.Kode_Klas_Atribut)as f where f.Kode_Tree = e.Kode_Tree") m = cs1.Fields(0).Value cs1.MoveFirst jml = 0 For k = 0 To cs1.RecordCount - 1 Kondisi = "" & cs1.Fields(1).Value & " " & cs1.Fields(2).Value & "" If cs1.Fields(3).Value "Next" Then Kondisi = Kondisi & " RESULT = " & cs1.Fields(3).Value & "" Else If cs1.Fields(3).Value = "Next" And cs1.Fields(4) = "UNCLASSIFIED" Then Kondisi = Kondisi & " RESULT = " & cs1.Fields(4).Value & "" End If End If 'kodetree = "" & cs1.Fields(4).Value & "" 'Set cs2 = db.Execute("select Parent From tree_parental_detail where Child = '" & ArrayKodeTree(j) & "'") If cs1.Fields(3).Value "Next" Then Set nodx = TreeView1.Nodes.Add("TREE001", tvwChild, "NULL" & jmlclassified & "", "" & Kondisi & "") jmlclassified = jmlclassified + 1 Else If cs1.Fields(3).Value = "Next" And cs1.Fields(4) = "UNCLASSIFIED" Then Set nodx = TreeView1.Nodes.Add("TREE001", tvwChild, "UNCLASSIFIED" & jmlunclassified & "", "" & Kondisi & "") jmlunclassified = jmlunclassified + 1 Else Set nodx = TreeView1.Nodes.Add("TREE001", tvwChild, "" & cs1.Fields(4).Value & "", "" & Kondisi & "") End If End If cs1.MoveNext Next Else Set cs1 = db.Execute("select e.Kode_Tree, e.Nama_Atribut, f.Klas_Atribut, f.Result, f.Child from (select a.Kode_Tree , b.Nama_Atribut from ((select * from atribut_tree) as a join (select * from atribut)as b on a.Kode_Atribut = b.Kode_Atribut) where a.level = '" & i & "' and Kode_Tree = '" &

  • ArrayKodeTree(j) & "') as e join (select c.Kode_Tree, c.Result,c.Child, d.Klas_Atribut from(select * from tree_klas_detail )as c join(select * from klas_atribut) as d on c.Kode_Klas_Atribut = d.Kode_Klas_Atribut)as f where f.Kode_Tree = e.Kode_Tree") cs1.MoveFirst For k = 0 To cs1.RecordCount - 1 Kondisi = "" & cs1.Fields(1).Value & " " & cs1.Fields(2).Value & "" If cs1.Fields(3).Value "Next" Then Kondisi = Kondisi & " RESULT = " & cs1.Fields(3).Value & "" Else If cs1.Fields(3).Value = "Next" And cs1.Fields(4) = "UNCLASSIFIED" Then Kondisi = Kondisi & " RESULT = " & cs1.Fields(4).Value & "" End If End If If cs1.Fields(3).Value "Next" Then Set nodx = TreeView1.Nodes.Add("" & ArrayKodeTree(j) & "", tvwChild, "NULL" & jmlclassified & "", "" & Kondisi & "") jmlclassified = jmlclassified + 1 Else If cs1.Fields(3).Value = "Next" And cs1.Fields(4) = "UNCLASSIFIED" Then Set nodx = TreeView1.Nodes.Add("" & ArrayKodeTree(j) & "", tvwChild, "UNCLASSIFIED" & jmlunclassified & "", "" & Kondisi & "") jmlunclassified = jmlunclassified + 1 Else Set nodx = TreeView1.Nodes.Add("" & ArrayKodeTree(j) & "", tvwChild, "" & cs1.Fields(4).Value & "", "" & Kondisi & "") End If End If cs1.MoveNext Next End If Next Next End Sub Private Sub RudieButton1_Click() Screen.MousePointer = vbNormal Me.WindowState = 0 Do Me.Left = Me.Left + 20 Me.Move Me.Left, Me.Top DoEvents Loop Until Me.Left > Screen.Width Unload Me End Sub

  • Private Sub Timer1_Timer() s = s + 1 Me.Caption = Mid(".::*Pohon Keputusan*::.", 1, s) If s = 30 Then Me.Caption = "" s = 0 End If End Sub Private Sub Timer2_Timer() z = z + 1 Label9.Caption = Mid("Gelar Nurcahya 2012", 1, z) If z = 22 Then Label9.Caption = "" z = 0 End If End Sub *Form Uji Data Input Private s, z As Integer Dim skinpath As String Private Const WS_EX_LAYERED = &H80000 Private Const GWL_EXSTYLE = (-20) Private Const LWA_COLORKEY = &H1 Private Const LWA_ALPHA = &H2 Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crColor As Long, ByVal nAlpha As Byte, ByVal dwFlags As Long) As Long Private Sub Form_Load() skinpath = App.Path & "\galaxy.skn" skn.LoadSkin skinpath skn.ApplySkin Me.hwnd Call SetWindowLong(Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED) Call SetLayeredWindowAttributes(Me.hwnd, RGB(255, 235, 255), 235, LWA_ALPHA Or LWA_COLORKEY) End Sub 'pengujian data inputan Private Sub RudieButton1_Click() Dim ArrayNamaAtribut(0 To 13, 0 To 1) As String

  • ArrayNamaAtribut(0, 0) = "age" ArrayNamaAtribut(1, 0) = "kredit" ArrayNamaAtribut(2, 0) = "housing" ArrayNamaAtribut(3, 0) = "loan" ArrayNamaAtribut(4, 0) = "marital" ArrayNamaAtribut(5, 0) = "education" ArrayNamaAtribut(6, 0) = "contact" ArrayNamaAtribut(7, 0) = "balance" ArrayNamaAtribut(8, 0) = "duration" ArrayNamaAtribut(9, 0) = "campaign" ArrayNamaAtribut(10, 0) = "pdays" ArrayNamaAtribut(11, 0) = "previous" ArrayNamaAtribut(12, 0) = "poutcome" ArrayNamaAtribut(13, 0) = "job" If optno.Value = False And optyes.Value = False Then jkdipilih = False Else jkdipilih = True End If If Option1.Value = False And Option2.Value = False Then jkdipilih1 = False Else jkdipilih1 = True End If If Option3.Value = False And Option4.Value = False Then jkdipilih2 = False Else jkdipilih2 = True End If If Option5.Value = False And Option6.Value = False And Option18.Value = False Then jkdipilih3 = False Else jkdipilih3 = True End If If Option7.Value = False And Option8.Value = False And Option9.Value = False And Option10.Value = False Then jkdipilih4 = False Else jkdipilih4 = True End If If Option11.Value = False And Option32.Value = False And Option13.Value = False Then jkdipilih5 = False Else jkdipilih5 = True End If

  • If Option14.Value = False And Option15.Value = False And Option16.Value = False And Option17.Value = False Then jkdipilih6 = False Else jkdipilih6 = True End If If Option19.Value = False And Option20.Value = False And Option22.Value = False And Option23.Value = False And Option24.Value = False And Option25.Value = False And Option26.Value = False And Option27.Value = False And Option28.Value = False And Option29.Value = False And Option30.Value = False And Option31.Value = False Then jkdipilih7 = False Else jkdipilih7 = True End If If jkdipilih = False Or txUsia.Text = "" Or jkdipilih1 = False Or jkdipilih2 = False Or jkdipilih3 = False Or jkdipilih4 = False And jkdipilih5 = False Or txTbalance = "" Or txduration = "" Or txCampaign = "" Or txPdays = "" Or txPrevious = "" Or jkdipilih6 = False Or jkdipilih7 = False Then MsgBox "data ada yang belum terlengkapi, silahkan lengkapi terlebih dahulu", vbCritical, "Incomplete Input" Else On Error Resume Next Set oz = db.Execute("select * from atribut") 'Klasifikasi Usia oz.MoveFirst If (txUsia.Text
  • 'Klasifikasi Loan If Option3.Value = True Then loan = "no" Else loan = "yes" End If oz.MoveNext 'Klasifikasi Marital If Option5.Value = True Then marital = "married" Else If Option6.Value = True Then marital = "single" Else marital = "divorced" End If End If oz.MoveNext 'Klasifikasi education If Option7.Value = True Then education = "primary" Else If Option8.Value = True Then education = "secondary" Else If Option9.Value = True Then education = "tertiary" Else education = "unknown" End If End If End If oz.MoveNext 'Klasifikasi contact If Option11.Value = True Then contact = "cellular" Else If Option32.Value = True Then contact = "telephone" Else contact = "unknown" End If End If oz.MoveNext

  • 'Klasifikasi balance If (txTbalance.Text
  • poutcome = "unknown" End If End If End If oz.MoveNext 'klasifikasi job If Option19.Value = True Then job = "unemployed" Else If Option20.Value = True Then job = "services" Else If Option31.Value = True Then job = "management" Else If Option22.Value = True Then job = "retired" Else If Option23.Value = True Then job = "admin." Else If Option24.Value = True Then job = "blue-collar" Else If Option25.Value = True Then job = "technician" Else If Option26.Value = True Then job = "self-employed" Else If Option27.Value = True Then job = "housemaid" Else If Option28.Value = True Then job = "entrepreneur" Else If Option29.Value = True Then job = "student" Else job = "unknown" End If End If End If End If End If End If End If End If End If

  • End If End If ArrayNamaAtribut(0, 1) = age ArrayNamaAtribut(1, 1) = kredit ArrayNamaAtribut(2, 1) = housing ArrayNamaAtribut(3, 1) = loan ArrayNamaAtribut(4, 1) = marital ArrayNamaAtribut(5, 1) = education ArrayNamaAtribut(6, 1) = contact ArrayNamaAtribut(7, 1) = balance ArrayNamaAtribut(8, 1) = duration ArrayNamaAtribut(9, 1) = campaign ArrayNamaAtribut(10, 1) = pdays ArrayNamaAtribut(11, 1) = Previous ArrayNamaAtribut(12, 1) = poutcome ArrayNamaAtribut(13, 1) = job kodetreecheck = "TREE001" Solved = "False" Do Set cs1 = db.Execute("select b.Nama_Atribut from((select * from atribut_tree) as a join (select * from atribut) as b on a.Kode_Atribut = b.Kode_Atribut ) where a.Kode_Tree = '" & kodetreecheck & "'") namaatributtest = cs1.Fields(0).Value fieldtest = 0 For j = 0 To 13 If ArrayNamaAtribut(j, 0) = namaatributtest Then fieldtest = (j) End If Next Set cs1 = db.Execute("select c.Kode_Tree, c.Kode_Klas_Atribut, d.Nama_Atribut, d.Klas_Atribut, c.Result, c.Child from((select * from tree_klas_detail) as c join (select a.Kode_Klas_Atribut, b.Nama_Atribut, a.Klas_Atribut from( (SELECT * FROM `klas_atribut`) as a join (select * from atribut) as b on a.Kode_Atribut = b.Kode_Atribut))as d on c.Kode_Klas_Atribut = d.Kode_Klas_Atribut )where c.Kode_Tree = '" & kodetreecheck & "' and d.Nama_Atribut = '" & namaatributtest & "'and d.Klas_Atribut ='" & ArrayNamaAtribut(fieldtest, 1) & "' ") If cs1.Fields(4).Value = "Next" And cs1.Fields(5) = "UNCLASSIFIED" Then Result = cs1.Fields(5).Value Solved = "True" Else If cs1.Fields(4).Value = "Next" Then kodetreecheck = cs1.Fields(5).Value Else Result = cs1.Fields(4).Value Solved = "True" End If End If

  • Loop While Solved = "False" lbHasil.Caption = "" & Result & "" End If End Sub Private Sub RudieButton2_Click() txUsia = "" txTbalance = "" txduration = "" txCampaign = "" txPdays = "" txPrevious = "" lbHasil = "" optno = False optyes = False Option1 = False Option2 = False Option3 = False Option4 = False Option5 = False Option6 = False Option7 = False Option8 = False Option9 = False Option10 = False Option11 = False Option12 = False Option13 = False Option14 = False Option15 = False Option16 = False Option17 = False Option18 = False Option19 = False Option20 = False Option21 = False Option22 = False Option23 = False Option24 = False Option25 = False Option26 = False Option27 = False Option28 = False Option29 = False Option30 = False Option31 = False Option32 = False End Sub Private Sub RudieButton3_Click()

  • Screen.MousePointer = vbNormal Me.WindowState = 0 Do Me.Left = Me.Left + 20 Me.Move Me.Left, Me.Top DoEvents Loop Until Me.Left > Screen.Width Unload Me End Sub Private Sub Timer1_Timer() s = s + 1 Me.Caption = Mid(".::*Pengujian Data Input*::.", 1, s) If s = 30 Then Me.Caption = "" s = 0 End If End Sub Private Sub Timer2_Timer() z = z + 1 Label6.Caption = Mid("Gelar Nurcahya 2012", 1, z) If z = 22 Then Label6.Caption = "" z = 0 End If End Sub Private Sub txduration_Change() If txduration.Text "" Then If Not IsNumeric(txduration.Text) Then MsgBox "bagian ini harus diisi angka!", vbCritical, "Input Salah" txduration.Text = "" End If End If End Sub Private Sub txCampaign_Change() If txCampaign.Text "" Then If Not IsNumeric(txCampaign.Text) Then MsgBox "bagian ini harus diisi ang