LAMPIRAN 1 :
DAFTAR PUBLIKASI ILMIAH PENULIS
No Judul Artikel Penulis Publikasi
(Seminar/Jurnal.
dll)
Waktu
Publikasi
Tempat
1 Pengaruh Kombinasi
Algoritma Nguyen
Widrow dan Adaptive Learning Rate pada Jaringan Syaraf Tiruan
LAMPIRAN 2:
LISTING PROGRAM
Private Sub Form_Load()
End Sub
Private Sub cmdExit_Click() Unload frmAbout
End Sub
Private Sub Form_Load()
End Sub
Private Sub Label2_Click() Unload frmAbout
End Sub
Private Sub cmdExit_Click() Unload Me
End Sub
Private Sub Label2_Click()
End Sub
Private Sub abt_Click() frmAbout.Show End Sub
Private Sub Adap_Click() frmTrainALR.Show End Sub
Private Sub Form_Load()
End Sub
Private Sub help_Click() frmHelp.Show
Private Sub Kom_Click() frmTrainNguyen.Show End Sub
Private Sub Ngu_Click() frmTrainBP.Show End Sub
Private Sub quit_Click() End
End Sub
Private Sub RegBP_Click() frmRecog.Show
End Sub
Private Sub RegKom_Click() frmRecogNguyen.Show End Sub
Option Explicit
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long
Dim R As Integer, G As Integer, B As Integer Dim X, Y, x1, x2, Y1, Y2, HX, HY As Integer Dim GreyColor, hasil As Integer
Dim Binari As Integer
Dim mat_A(100, 100) As Integer Dim mat_A1(100, 100) As Integer Dim mat_B(10, 10) As Integer Dim mat_C(50, 2) As Integer Dim db_hasil(1, 100) As Integer Dim mat_Input(50, 2) As Integer
Dim mat_target(50), db_target(50), target(50), bobot1, bobot2 As Integer Dim input1(50) As Integer
Dim input2(50) As Integer
Dim v(1, 3), v0(3), w(3), w0, z_in(3), z(3), Y_in, y_akt, delta_w(3) As Double Dim delta_in(3), delta(3), delta_v(1, 3), delta_v0(3), delta_w0 As Double Dim ID As Integer
Sub CariID() ID = 0
Set rsCari = New ADODB.Recordset
If Not rsCari.EOF Then ID = rsCari!ID + 1 Else
ID = 1 End If
Set rsCari = Nothing End Sub
Private Sub cmdBersih_Click() lblFileTitle.Caption = "" txtHasil.Text = "" lblPersen.Caption = "" txtSebagai = "" List1.Clear
Picture1.Picture = Nothing Pic2.Picture = Nothing Pic1.Picture = Nothing Text1 = ""
R = 0 G = 0 B = 0 X = 0 Y = 0 x1 = 0 x2 = 0 Y1 = 0 Y2 = 0 HX = 0 HY = 0 GreyColor = 0 hasil = 0 Binari = 0
z(3) = 0 Y_in = 0 y_akt = 0 delta_w(3) = 0 delta_in(3) = 0 delta(3) = 0 delta_v(1, 3) = 0 delta_v0(3) = 0 delta_w0 = 0 ID = 0
txtWaktu.Text = "" pBar.Visible = False cmdProses.Enabled = False cmdOpen.Enabled = True End Sub
Private Sub cmdExit_Click() Unload Me
End Sub
Public Function Greyscale(ByVal Colr As Long) As Integer Dim R As Long, G As Long, B As Long
R = Colr Mod 256 Colr = Colr \ 256 G = Colr Mod 256 Colr = Colr \ 256 B = Colr Mod 256
If R < 0 Then R = 0: If R > 255 Then R = 255 If G < 0 Then G = 0: If G > 255 Then G = 255 If B < 0 Then B = 0: If B > 255 Then B = 255
Greyscale = (76 * R) / 255 + 150 * G / 255 + 28 * B / 255 If Greyscale > 190 Then
Greyscale = 255 Binari = 0 Else
Greyscale = 0 Binari = 1 End If
End Function Sub ProsessImage()
Picture1.AutoRedraw = True DoEvents
For Y = 0 To (Picture1.Height / Screen.TwipsPerPixelY) For X = 0 To (Picture1.Width / Screen.TwipsPerPixelX) GreyColor = Greyscale(GetPixel(Picture1.hdc, X, Y))
SetPixel Picture1.hdc, X, Y, RGB(GreyColor, GreyColor, GreyColor) Next X
Next Y
pBar.Value = 30 End Sub
Private Sub cmdOpen_Click() cd.Filter = "Image|*.bmp;*.jpg" cd.ShowOpen
Picture1.Cls
If cd.FileName = "" Then Exit Sub Me.Height = 11760
ipc.Picture = LoadPicture(cd.FileName) ipc1.Picture = LoadPicture(cd.FileName) ipc2.Picture = LoadPicture(cd.FileName) Picture1.Picture = LoadPicture(cd.FileName) Picture1.AutoRedraw = True
Picture1.PaintPicture Picture1.Picture, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight
Picture1.Refresh
Pic2.Picture = Picture1.Picture Call CariID
lblFileTitle.Caption = cd.FileTitle cmdProses.Enabled = True End Sub
Private Sub cmdProses_Click() cmdOpen.Enabled = False cmdProses.Enabled = False pBar.Visible = True
If lblFileTitle.Caption <> "" Then Call Thin
Call Selesai
Dim i, j, k, akhir, hitung, KuRang As Integer Dim temp1, temp2 As Integer
Dim w1, w2, per_a, Y_in, Tetha, Eror, alfa, hasil As Double Dim Nama As String
For i = 0 To Ttarget temp1 = mat_Input(i, 0) input1(i) = temp1 temp2 = mat_Input(i, 1) input2(i) = temp2 Next i
Tetha = 0.5 alfa = 1 Call CariID akhir = ID
For j = 1 To akhir
Set rsCari = New ADODB.Recordset
rsCari.Open "Select * from tData where ID=" & j & " and Algo='BP'", CN, 1, 2
If Not rsCari.EOF Then Nama = rsCari!Nama w0 = rsCari!w0
For i = 0 To InputNode100
v(0, i) = rsCari.Fields("v1" & i + 1).Value v(1, i) = rsCari.Fields("v2" & i + 1).Value v0(i) = rsCari.Fields("v0" & i + 1).Value w(i) = rsCari.Fields("w" & i + 1).Value Next i
For i = 0 To Ttarget - 1
db_target(i) = rsCari.Fields("target" & i).Value Next i
End If
Set rsCari = Nothing hitung = 0
KuRang = 0
For k = 0 To Ttarget - 1 For i = 0 To HiddenNode6
z_in(i) = v0(i) + (v(0, i) * input1(k)) + (v(1, i) * input2(k)) Next i
For i = 0 To HiddenNode6
z(i) = 1 / (1 + Exp(-1 * z_in(i))) z(i) = Round(z(i), 4)
Next i
Y_in = w0 + (w(0) * z(0)) + (w(1) * z(1)) + (w(2) * z(2)) + (w(3) * z(3)) y_akt = 1 / (1 + Exp(-1 * Y_in))
hasil = Round(y_akt, 4) If hasil > Tetha Then hasil = 1
Else hasil = 0 End If
If hasil = db_target(k) Then hitung = hitung + 1 Else
KuRang = KuRang + 1 End If
Next k
hitung = (hitung / Epoh100) * 100
List1.AddItem " " & j & " " & "Karakter=" & Nama & " " & hitung & "%" & vbCrLf
time.StopTimer
txtWaktu.Text = time.Elasped / 3600
Dim ban1, ban2 As Integer For j = 1 To akhir - 1 ban1 = db_hasil(1, 1) ban2 = db_hasil(1, j + 1) If ban2 < ban1 Then
db_hasil(1, 1) = db_hasil(1, j + 1) db_hasil(0, 1) = db_hasil(0, j + 1) End If
Next j
ban1 = db_hasil(0, 1) For j = 0 To akhir
Set rsCari = New ADODB.Recordset
rsCari.Open "Select * from tData where ID=" & ban1 & "", CN, 1, 2 If Not rsCari.EOF Then
txtSebagai.Text = rsCari!Nama Else
txtSebagai.Text = "" End If
Set rsCari = Nothing Next j
lblPersen.Caption = db_hasil(1, 1) & " %"
If db_hasil(1, 1) >= 100 Then 'Val(lblPersen.Caption) Then txtHasil.Text = "Dikenal"
Else
txtHasil.Text = "Tidak dikenal" End If
Else
MsgBox "Input karakter" End If
pBar.Value = 100
End Sub Sub Thin()
ipc1.Visible = True ipc1.colnorm3 200 ipc1.scalesign 2
ipc1.filtersmooth ipc1.colnorm3 180 ipc1.getsign ipc1.Thin
ipc2.Visible = True ipc2.colnorm3 200 ipc2.scalesign 2 ipc2.filtersmooth
ipc2.colnorm3 180 ipc2.getsign
Pic2.Picture = ipc.Picture ipc2.Visible = False ipc.Visible = False Me.Height = 8610 End Sub
Sub Selesai() Dim i, j As Long Call ProsessImage pBar.Value = 30 Call Matriks_biner pBar.Value = 70 Call Reduksi pBar.Value = 80 Call Transposisi Call Matriks_biner1 End Sub
Sub Matriks_biner()
Dim i As Integer, j As Integer Picture1.AutoRedraw = True For Y = 0 To 99
i = Y
For X = 0 To 99 j = X
GreyColor = Greyscale(GetPixel(Picture1.hdc, X, Y)) mat_A(i, j) = Binari
Next X
Picture1.Refresh Next Y
Dim temp As Integer For Y = 0 To 100 i = Y
For X = 0 To 100 j = X
temp = mat_A(i, j) If temp = 0 Then
'Text1.Text = Text1.Text + "1" Else
' Text1.Text = Text1.Text + "0" End If
Next X
Next Y End Sub
Sub Matriks_biner1()
Dim i As Integer, j As Integer
For Y = 0 To 99 i = Y
For X = 0 To 99 j = X
GreyColor = Greyscale(GetPixel(Pic2.hdc, X, Y)) mat_A1(i, j) = Binari
Next X
Next Y
Dim temp As Integer For Y = 0 To 99 Step 10 i = Y
For X = 0 To 99 Step 10 j = X
temp = mat_A1(i, j) If temp = 0 Then
Text1.Text = Text1.Text + "1" Else
Text1.Text = Text1.Text + "0" End If
Next X
Text1.Text = Text1.Text & vbCrLf Next Y
End Sub Sub Reduksi()
'Text1.Text = Text1.Text & vbCrLf
Dim i As Integer, j As Integer, k As Integer, l As Integer, m As Integer Dim hasil As Integer
Dim n As Integer time.StartTimer i = 0
m = 0
For k = 0 To 9 m = l + 9 For i = 1 To m For j = 0 To 9 n = mat_A(i, j) hasil = hasil + 1 mat_B(k, 0) = hasil Next j
For j = 10 To 19 n = mat_A(i, j) hasil = hasil + n mat_B(k, 1) = hasil Next j
Next i hasil = 0
For i = 1 To m For j = 20 To 29 n = mat_A(i, j) hasil = hasil + n mat_B(k, 2) = hasil Next j
Next i hasil = 0
For i = 1 To m For j = 30 To 39 n = mat_A(i, j) hasil = hasil + n mat_B(k, 3) = hasil Next j
Next i hasil = 0
For i = 1 To m For j = 40 To 49 n = mat_A(i, j) hasil = hasil + n mat_B(k, 4) = hasil Next j
Next i hasil = 0
For i = 1 To m For j = 50 To 59 n = mat_A(i, j) hasil = hasil + n mat_B(k, 5) = hasil Next j
Next i hasil = 0
Next j Next i hasil = 0
For i = 1 To m For j = 70 To 79 n = mat_A(i, j) hasil = hasil + n mat_B(k, 7) = hasil Next j
Next i hasil = 0
For i = 1 To m For j = 80 To 89 n = mat_A(i, j) hasil = hasil + n mat_B(k, 8) = hasil Next j
Next i hasil = 0
For i = 1 To m For j = 90 To 99 n = mat_A(i, j) hasil = hasil + n mat_B(k, 9) = hasil Next j
Next i hasil = 0 l = l + 10 Next k
'Dim temp As Integer ' For Y = 0 To 9 ' i = Y
' For X = 0 To 9 ' j = X
' temp = mat_B(i, j)
' If (temp > 0) And (temp <= 100) Then ' Text1.Text = Text1.Text + "1 " ' Else
' Text1.Text = Text1.Text + "0 " ' End If
' Next X
' Text1.Text = Text1.Text & vbCrLf ' Next Y
End Sub
Dim i As Integer, j As Integer Dim temp, temp1 As Integer For Y = 0 To 1
For X = 0 To 9
temp = mat_B(Y, X) mat_C(X, Y) = temp Next X
Next Y
For Y = 2 To 3 For X = 0 To 9
temp = mat_B(Y, X)
mat_C(X + 10, Y - 2) = temp Next X
Next Y
For Y = 4 To 5 For X = 0 To 9
temp = mat_B(Y, X)
mat_C(X + 20, Y - 4) = temp Next X
Next Y
For Y = 6 To 7 For X = 0 To 9
temp = mat_B(Y, X)
mat_C(X + 30, Y - 6) = temp Next X
Next Y
For Y = 8 To 9 For X = 0 To 9
temp = mat_B(Y, X)
mat_C(X + 40, Y - 8) = temp Next X
Next Y
For Y = 0 To 49 i = Y
For X = 0 To 1 j = X
temp = mat_C(i, j)
If (temp > 0) And (temp < 100) Then temp1 = 1
mat_Input(i, j) = temp1 Else
temp1 = 0
End If Next X
Next Y
End Sub
Private Sub Form_Activate() cmdProses.Enabled = False cmdOpen.Enabled = True Me.Height = 8610
End Sub
Private Sub Form_Load() Call Koneksi
pBar.Visible = False pBar.Min = 0 pBar.Max = 100 End Sub
Option Explicit
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long
Dim R As Integer, G As Integer, B As Integer Dim X, Y, x1, x2, Y1, Y2, HX, HY As Integer Dim GreyColor, hasil As Integer
Dim Binari As Integer
Dim mat_A(100, 100) As Integer Dim mat_A1(100, 100) As Integer Dim mat_B(10, 10) As Integer Dim mat_C(50, 2) As Integer Dim db_hasil(1, 100) As Integer Dim mat_Input(50, 2) As Integer
Dim mat_target(50), db_target(50), target(50), bobot1, bobot2 As Integer Dim input1(50) As Integer
Dim input2(50) As Integer
Dim v(1, 3), v0(3), w(3), w0, z_in(3), z(3), Y_in, y_akt, delta_w(3) As Double Dim delta_in(3), delta(3), delta_v(1, 3), delta_v0(3), delta_w0 As Double Dim ID As Integer
Sub CariID() ID = 0
Set rsCari = New ADODB.Recordset
rsCari.Open "Select * from tData order by ID desc", CN, 1, 2 If Not rsCari.EOF Then
Else ID = 1 End If
Set rsCari = Nothing End Sub
Private Sub cmdBersih_Click() lblFileTitle.Caption = "" txtHasil.Text = "" lblPersen.Caption = "" txtSebagai = "" List1.Clear
Picture1.Picture = Nothing Pic2.Picture = Nothing Pic1.Picture = Nothing Text1 = ""
R = 0 G = 0 B = 0 X = 0 Y = 0 x1 = 0 x2 = 0 Y1 = 0 Y2 = 0 HX = 0 HY = 0 GreyColor = 0 hasil = 0 Binari = 0
y_akt = 0 delta_w(3) = 0 delta_in(3) = 0 delta(3) = 0 delta_v(1, 3) = 0 delta_v0(3) = 0 delta_w0 = 0 ID = 0
txtWaktu.Text = "" pBar.Visible = False time.StopTimer
cmdProses.Enabled = False cmdOpen.Enabled = True End Sub
Private Sub cmdExit_Click() Unload Me
End Sub
Public Function Greyscale(ByVal Colr As Long) As Integer Dim R As Long, G As Long, B As Long
R = Colr Mod 256 Colr = Colr \ 256 G = Colr Mod 256 Colr = Colr \ 256 B = Colr Mod 256
If R < 0 Then R = 0: If R > 255 Then R = 255 If G < 0 Then G = 0: If G > 255 Then G = 255 If B < 0 Then B = 0: If B > 255 Then B = 255
Greyscale = (76 * R) / 255 + 150 * G / 255 + 28 * B / 255 If Greyscale > 190 Then
Greyscale = 255 Binari = 0 Else
Greyscale = 0 Binari = 1 End If
End Function Sub ProsessImage()
Picture1.AutoRedraw = True DoEvents
For Y = 0 To (Picture1.Height / Screen.TwipsPerPixelY) For X = 0 To (Picture1.Width / Screen.TwipsPerPixelX) GreyColor = Greyscale(GetPixel(Picture1.hdc, X, Y))
SetPixel Picture1.hdc, X, Y, RGB(GreyColor, GreyColor, GreyColor) Next X
pBar.Value = 30 End Sub
Private Sub cmdOpen_Click() cd.Filter = "Image|*.bmp;*.jpg" cd.ShowOpen
Picture1.Cls
If cd.FileName = "" Then Exit Sub Me.Height = 11760
ipc.Picture = LoadPicture(cd.FileName) ipc1.Picture = LoadPicture(cd.FileName) ipc2.Picture = LoadPicture(cd.FileName) Picture1.Picture = LoadPicture(cd.FileName) Picture1.AutoRedraw = True
Picture1.PaintPicture Picture1.Picture, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight
Picture1.Refresh
Pic2.Picture = Picture1.Picture Call CariID
lblFileTitle.Caption = cd.FileTitle cmdProses.Enabled = True End Sub
Private Sub cmdProses_Click() cmdOpen.Enabled = False cmdProses.Enabled = False pBar.Visible = True
If lblFileTitle.Caption <> "" Then Call Thin
Call Selesai
Dim i, j, k, akhir, hitung, KuRang As Integer Dim temp1, temp2 As Integer
Dim w1, w2, per_a, Y_in, Tetha, Eror, alfa, hasil As Double Dim Nama As String
For i = 0 To Ttarget temp1 = mat_Input(i, 0) input1(i) = temp1 temp2 = mat_Input(i, 1) input2(i) = temp2 Next i
Tetha = 0.5 alfa = 1 Call CariID akhir = ID
For j = 1 To akhir
Set rsCari = New ADODB.Recordset
rsCari.Open "Select * from tData where ID=" & j & " and Algo='Kombinasi'", CN, 1, 2
If Not rsCari.EOF Then Nama = rsCari!Nama w0 = rsCari!w0
For i = 0 To InputNode100
v(0, i) = rsCari.Fields("v1" & i + 1).Value v(1, i) = rsCari.Fields("v2" & i + 1).Value v0(i) = rsCari.Fields("v0" & i + 1).Value w(i) = rsCari.Fields("w" & i + 1).Value Next i
For i = 0 To Ttarget - 1
db_target(i) = rsCari.Fields("target" & i).Value Next i
End If
Set rsCari = Nothing hitung = 0
KuRang = 0
For k = 0 To Ttarget - 1 For i = 0 To HiddenNode6
z_in(i) = v0(i) + (v(0, i) * input1(k)) + (v(1, i) * input2(k)) Next i
For i = 0 To HiddenNode6
z(i) = 1 / (1 + Exp(-1 * z_in(i))) z(i) = Round(z(i), 4)
Next i
Y_in = w0 + (w(0) * z(0)) + (w(1) * z(1)) + (w(2) * z(2)) + (w(3) * z(3)) y_akt = 1 / (1 + Exp(-1 * Y_in))
hasil = Round(y_akt, 4) If hasil > Tetha Then hasil = 1
Else hasil = 0 End If
If hasil = db_target(k) Then hitung = hitung + 1 Else
KuRang = KuRang + 1 End If
Next k
hitung = (hitung / Epoh100) * 100
List1.AddItem " " & j & " " & "Karakter=" & Nama & " " & hitung & "%" & vbCrLf
db_hasil(1, j) = hitung Next j
time.StartTimer For i = 0 To 50
temp1 = mat_Input(i, 0) 'input1(i) = temp1 temp2 = mat_Input(i, 1) 'input2(i) = temp2 Next i
time.StopTimer
txtWaktu.Text = ((time.Elasped) / 3600) / 2
Dim ban1, ban2 As Integer For j = 1 To akhir - 1 ban1 = db_hasil(1, 1) ban2 = db_hasil(1, j + 1) If ban2 < ban1 Then
db_hasil(1, 1) = db_hasil(1, j + 1) db_hasil(0, 1) = db_hasil(0, j + 1) End If
Next j
ban1 = db_hasil(0, 1) For j = 0 To akhir
Set rsCari = New ADODB.Recordset
rsCari.Open "Select * from tData where ID=" & ban1 & "", CN, 1, 2 If Not rsCari.EOF Then
txtSebagai.Text = rsCari!Nama Else
txtSebagai.Text = "" End If
Set rsCari = Nothing Next j
lblPersen.Caption = db_hasil(1, 1) & " %"
If db_hasil(1, 1) >= 100 Then 'Val(lblPersen.Caption) Then txtHasil.Text = "Dikenal"
Else
txtHasil.Text = "Tidak dikenal" End If
Else
MsgBox "Input karakter" End If
pBar.Value = 100
End Sub Sub Thin()
ipc1.filtersmooth ipc1.colnorm3 180 ipc1.getsign ipc1.Thin
Pic1.Picture = ipc1.Picture ipc1.Visible = False
ipc2.Visible = True ipc2.colnorm3 200 ipc2.scalesign 2 ipc2.filtersmooth
ipc2.colnorm3 180 ipc2.getsign
Pic2.Picture = ipc.Picture ipc2.Visible = False ipc.Visible = False Me.Height = 8610 End Sub
Sub Selesai() Dim i, j As Long Call ProsessImage pBar.Value = 30 Call Matriks_biner pBar.Value = 70 Call Reduksi pBar.Value = 80 Call Transposisi Call Matriks_biner1 End Sub
Sub Matriks_biner()
Dim i As Integer, j As Integer Picture1.AutoRedraw = True For Y = 0 To 99
i = Y
For X = 0 To 99 j = X
GreyColor = Greyscale(GetPixel(Picture1.hdc, X, Y)) mat_A(i, j) = Binari
Next X
Picture1.Refresh Next Y
Dim temp As Integer For Y = 0 To 100 i = Y
j = X
temp = mat_A(i, j) If temp = 0 Then
'Text1.Text = Text1.Text + "1" Else
' Text1.Text = Text1.Text + "0" End If
Next X
'Text1.Text = Text1.Text & vbCrLf Next Y
End Sub
Sub Matriks_biner1()
Dim i As Integer, j As Integer
For Y = 0 To 99 i = Y
For X = 0 To 99 j = X
GreyColor = Greyscale(GetPixel(Pic2.hdc, X, Y)) mat_A1(i, j) = Binari
Next X
Next Y
Dim temp As Integer For Y = 0 To 99 Step 10 i = Y
For X = 0 To 99 Step 10 j = X
temp = mat_A1(i, j) If temp = 0 Then
Text1.Text = Text1.Text + "1" Else
Text1.Text = Text1.Text + "0" End If
Next X
Text1.Text = Text1.Text & vbCrLf Next Y
End Sub Sub Reduksi()
'Text1.Text = Text1.Text & vbCrLf
Dim i As Integer, j As Integer, k As Integer, l As Integer, m As Integer Dim hasil As Integer
Dim n As Integer
i = 0 m = 0
For i = 1 To m For j = 0 To 9 n = mat_A(i, j) hasil = hasil + 1 mat_B(k, 0) = hasil Next j
Next i hasil = 0 For i = 1 To m For j = 10 To 19 n = mat_A(i, j) hasil = hasil + n mat_B(k, 1) = hasil Next j
Next i hasil = 0
For i = 1 To m For j = 20 To 29 n = mat_A(i, j) hasil = hasil + n mat_B(k, 2) = hasil Next j
Next i hasil = 0
For i = 1 To m For j = 30 To 39 n = mat_A(i, j) hasil = hasil + n mat_B(k, 3) = hasil Next j
Next i hasil = 0
For i = 1 To m For j = 40 To 49 n = mat_A(i, j) hasil = hasil + n mat_B(k, 4) = hasil Next j
Next i hasil = 0
Next j Next i hasil = 0
For i = 1 To m For j = 60 To 69 n = mat_A(i, j) hasil = hasil + n mat_B(k, 6) = hasil Next j
Next i hasil = 0
For i = 1 To m For j = 70 To 79 n = mat_A(i, j) hasil = hasil + n mat_B(k, 7) = hasil Next j
Next i hasil = 0
For i = 1 To m For j = 80 To 89 n = mat_A(i, j) hasil = hasil + n mat_B(k, 8) = hasil Next j
Next i hasil = 0
For i = 1 To m For j = 90 To 99 n = mat_A(i, j) hasil = hasil + n mat_B(k, 9) = hasil Next j
Next i hasil = 0 l = l + 10 Next k
'Dim temp As Integer ' For Y = 0 To 9 ' i = Y
' For X = 0 To 9 ' j = X
' temp = mat_B(i, j)
' Text1.Text = Text1.Text + "1 " ' Else
' Text1.Text = Text1.Text + "0 " ' End If
' Next X
' Text1.Text = Text1.Text & vbCrLf ' Next Y
End Sub
Sub Transposisi()
Dim i As Integer, j As Integer Dim temp, temp1 As Integer For Y = 0 To 1
For X = 0 To 9
temp = mat_B(Y, X) mat_C(X, Y) = temp Next X
Next Y
For Y = 2 To 3 For X = 0 To 9
temp = mat_B(Y, X)
mat_C(X + 10, Y - 2) = temp Next X
Next Y
For Y = 4 To 5 For X = 0 To 9
temp = mat_B(Y, X)
mat_C(X + 20, Y - 4) = temp Next X
Next Y
For Y = 6 To 7 For X = 0 To 9
temp = mat_B(Y, X)
mat_C(X + 30, Y - 6) = temp Next X
Next Y
For Y = 8 To 9 For X = 0 To 9
temp = mat_B(Y, X)
mat_C(X + 40, Y - 8) = temp Next X
Next Y
For X = 0 To 1 j = X
temp = mat_C(i, j)
If (temp > 0) And (temp < 100) Then temp1 = 1
mat_Input(i, j) = temp1 Else
temp1 = 0
mat_Input(i, j) = temp1 End If
Next X Next Y
End Sub
Private Sub Form_Activate() cmdProses.Enabled = False cmdOpen.Enabled = True Me.Height = 8610
End Sub
Private Sub Form_Load() Call Koneksi
pBar.Visible = False pBar.Min = 0 pBar.Max = 100
'cboBobot.AddItem "Nguyen_W" End Sub
'Option Explicit
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long
Dim R As Integer, G As Integer, B As Integer Dim X, Y, x1, x2, Y1, Y2, HX, HY As Integer Dim GreyColor, hasil As Integer
Dim Binari As Integer
Dim mat_A(100, 100) As Integer Dim mat_A1(200, 200) As Single Dim mat_B(10, 10) As Integer Dim mat_C(50, 2) As Integer Dim db_hasil(1, 100) As Integer Dim mat_Input(100, 2) As Integer
Dim mat_target(100), db_target(100), target(100), bobot1, bobot2 As Integer Dim input1(100) As Integer
Dim v00(100) As Double
Dim v(1, 3), v0(3), w(3), w0, z_in(3), z(3), Y_in, y_akt, delta_w(3) As Double Dim v_in(3) As Double
Dim v_in00(100) As Double
Dim delta_in(3), delta(3), delta_v(1, 3), delta_v0(3), delta_w0 As Double Dim MaxEpoh As Integer
Dim Betha As Single
Dim v1(100, 100) As Double Dim v2(100, 100) As Double
Dim ID As Integer, ID_W As Integer, ID_W1 As Integer, ID_V0 As Integer, ID_V1 As Integer, ID_V2 As Integer, ID_W0 As Integer
Dim v01(100) As Double Dim v21(100, 100) As Double Dim w1(100) As Double Sub CariID()
ID = 0
txtNo.Text = ""
Set rsCari = New ADODB.Recordset
rsCari.Open "Select * from tData order by ID desc", CN, 1, 2 If Not rsCari.EOF Then
ID = rsCari!ID + 1 Else
ID = 1 End If
Set rsCari = Nothing txtNo.Text = ID
End Sub Sub Segar1() Dim j As ListItem lvData.ListItems.Clear
Set rsCari = New ADODB.Recordset
rsCari.Open "Select * from tData order by ID asc", CN, 1, 2 If Not rsCari.EOF Then
Do While Not rsCari.EOF ID = rsCari!ID
j.SubItems(13) = rsCari!v04 j.SubItems(14) = rsCari!w1 j.SubItems(15) = rsCari!w2 j.SubItems(16) = rsCari!w3 j.SubItems(17) = rsCari!w4 j.SubItems(18) = rsCari!w0
rsCari.MoveNext If rsCari.EOF Then Exit Do
End If Loop End If
End Sub Sub Segar() Dim j As ListItem lvData.ListItems.Clear Dim rsCari1 As Recordset Dim Nm As String
Set rsCari = New ADODB.Recordset
rsCari.Open "Select * from tDataV1 where Algo='BP' order by ID asc", CN, 1, 2 If Not rsCari.EOF Then
Do While Not rsCari.EOF ID = rsCari!ID
Set rsCari1 = New ADODB.Recordset
rsCari1.Open "Select * from tData Where ID =" & ID & "", CN, 1, 2 If Not rsCari1.EOF Then
Nm = rsCari1!Nama Else
Nm = "-" End If
Set rsCari1 = Nothing
Set j = lvData.ListItems.Add(, , ID) j.SubItems(1) = Nm
j.SubItems(15) = rsCari!v114 j.SubItems(16) = rsCari!v115 j.SubItems(17) = rsCari!v116 j.SubItems(18) = rsCari!v117 j.SubItems(19) = rsCari!v118 j.SubItems(20) = rsCari!v119 j.SubItems(21) = rsCari!v120
rsCari.MoveNext If rsCari.EOF Then Exit Do
End If Loop End If
Set rsCari = Nothing End Sub
Sub Bersih() txtNo.Text = "" txtNama.Text = "" Text1.Text = "" Text3.Text = "" txtWaktu.Text = "" txtTarget.Text = "" lblTarget.Caption = "" txtTarget.Enabled = False Picture1.Picture = Nothing Pic1.Picture = Nothing ipc.Picture = Nothing ipc1.Picture = Nothing ipc2.Picture = Nothing Pic2.Picture = Nothing ipc.Visible = False ipc1.Visible = False ipc2.Visible = False Picture2.Visible = False
Set rsCari = New ADODB.Recordset
rsCari.Open "Delete from Piksel", CN, 1, 2 Set rsCari = Nothing
End Sub
Public Function Greyscale(ByVal Colr As Long) As Integer Dim R As Long, G As Long, B As Long
'r = Colr And RGB(255, 0, 0)
'g = Int((Colr And RGB(0, 255, 0)) / 256)
'b = Int(Int((Colr And RGB(0, 0, 255)) / 256) / 256)
If R < 0 Then R = 0: If R > 255 Then R = 255 If G < 0 Then G = 0: If G > 255 Then G = 255 If B < 0 Then B = 0: If B > 255 Then B = 255
Greyscale = (76 * R) / 255 + 150 * G / 255 + 28 * B / 255 'Greyscale = (r + g + b) / 3
If Greyscale > 190 Then Greyscale = 255 Binari = 0 Else
Greyscale = 0 Binari = 1 End If
End Function Sub ProsessImage()
Picture1.AutoRedraw = True DoEvents
For Y = 0 To (Picture1.Height / Screen.TwipsPerPixelY) For X = 0 To (Picture1.Width / Screen.TwipsPerPixelX) GreyColor = Greyscale(GetPixel(Picture1.hdc, X, Y))
SetPixel Picture1.hdc, X, Y, RGB(GreyColor, GreyColor, GreyColor) Next X
Picture1.Refresh Next Y
End Sub
Private Sub cmdBersih_Click() Call Bersih
cmdOpen.Enabled = True cmdProses.Enabled = False cmdTrain.Enabled = False cmdSave.Enabled = False cmdOpen.Enabled = True End Sub
Private Sub cmdExit_Click() Unload Me
End Sub
Private Sub cmdOpen_Click() cd.Filter = "Image|*.bmp;*.jpg" cd.ShowOpen
Picture1.Cls
If cd.FileName = "" Then Exit Sub
Picture1.AutoRedraw = True
Picture1.PaintPicture Picture1.Picture, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight
Picture1.Refresh ipc.Visible = True ipc1.Visible = True ipc2.Visible = True
ipc.Picture = LoadPicture(cd.FileName) ipc1.Picture = LoadPicture(cd.FileName) ipc2.Picture = LoadPicture(cd.FileName) Picture2.Visible = True
Call CariID
txtNama.Text = cd.FileTitle cmdProses.Enabled = True
End Sub
Private Sub cmdProses_Click() cmdOpen.Enabled = False cmdProses.Enabled = False Pic3.Visible = True
Picture2.Visible = True
Call Resize
ipc1.Visible = True
'ipc1.Picture = Pic2.Picture ipc1.Visible = True
ipc1.colnorm3 180 ipc1.scalesign 1.5
ipc1.filtersmooth ipc1.colnorm3 180 ipc1.getsign ipc1.Thin
Picture2.Picture = ipc1.Picture ipc1.Visible = False
ipc2.Visible = True ipc2.colnorm3 200 ipc2.scalesign 2 ipc2.filtersmooth
ipc2.colnorm3 180 ipc2.getsign
pBar.Visible = True pBar.Value = 10
txtTarget.Enabled = True txtTarget.SetFocus End Sub
Private Sub cmdReset_Click() Dim X As String
X = MsgBox("Semua data training mau dihapus ?", vbYesNo) If X = vbYes Then
Set rsCari = New ADODB.Recordset
rsCari.Open "Delete from Piksel", CN, 1, 2 Set rsCari = Nothing
Set rsCari = New ADODB.Recordset
rsCari.Open "Delete from tDataV1 where Algo = 'BP'", CN, 1, 2 Set rsCari = Nothing
Set rsCari = New ADODB.Recordset
rsCari.Open "Delete from tDataV2 where Algo = 'BP'", CN, 1, 2 Set rsCari = Nothing
Set rsCari = New ADODB.Recordset
rsCari.Open "Delete from tData where Algo = 'BP'", CN, 1, 2 Set rsCari = Nothing
'Call Segar Else
Exit Sub End If End Sub
Private Sub cmdSave_Click() cmdSave.Enabled = False
If (txtNo.Text = "") Or (txtNama.Text = "") Then MsgBox "Isi data"
Exit Sub End If
Set rsCari = New ADODB.Recordset rsCari.Open "tData", CN, 1, 2 rsCari.AddNew
rsCari.Fields("ID").Value = txtNo.Text rsCari.Fields("nama").Value = txtNama.Text Dim i As Integer
For i = 0 To 3
rsCari.Fields("w" & i + 1).Value = w(i) Next i
rsCari.Fields("w0").Value = w0 For i = 0 To 49
rsCari.Fields("target" & i).Value = target(i) Next i
rsCari.Fields("target").Value = txtTarget.Text rsCari.Fields("Algo").Value = "BP"
rsCari.Update Set rsCari = Nothing
ID_V1 = 0
Set rsCari = New ADODB.Recordset
rsCari.Open "Select * from tDataV1 order by ID desc", CN, 1, 2 If Not rsCari.EOF Then
ID_V1 = rsCari!ID + 1 Else
ID_V1 = 1 End If
Set rsCari = Nothing
Set rsCari = New ADODB.Recordset rsCari.Open "tDataV1", CN, 1, 2 rsCari.AddNew
rsCari.Fields("ID").Value = ID_V1 For i = 0 To 99
rsCari.Fields("v1" & i + 1).Value = v1(0, i) Next i
rsCari!Algo = "BP" rsCari.Update Set rsCari = Nothing
ID_V2 = 0
Set rsCari = New ADODB.Recordset
rsCari.Open "Select * from tDataV2 order by ID desc", CN, 1, 2 If Not rsCari.EOF Then
ID_V2 = rsCari!ID + 1 Else
ID_V2 = 1 End If
Set rsCari = Nothing
Set rsCari = New ADODB.Recordset rsCari.Open "tDataV2", CN, 1, 2 rsCari.AddNew
rsCari.Fields("ID").Value = ID_V2 For i = 0 To 99
Next i
rsCari!Algo = "BP" rsCari.Update Set rsCari = Nothing
'Call Segar Call Bersih
MsgBox "Data sdh disimpan" End Sub
Private Sub cmdTrain_Click() Dim Epoch100 As Integer Epoch100 = 100
cmdTrain.Enabled = False Call akhir
Dim temp1, temp2, temp3, Epoh, max_epoh, hitung, i, j As Integer
Dim alfa, target_Error, per_Error, kuadrat_Error, delta_Error, kuadrat_Error_rerata As Double
MaxEpoh = Epoh100 time.StartTimer For i = 0 To MaxEpoh temp1 = mat_Input(i, 0) input1(i) = temp1 temp2 = mat_Input(i, 1) input2(i) = temp2 temp3 = mat_target(i) target(i) = temp3 Next i
i = 0
v(0, 0) = 0.9562 v(0, 1) = 0.7762 v(0, 2) = 0.1623 v(0, 3) = 0.2886
v(1, 0) = 0.1962 v(1, 1) = 0.6133 v(1, 2) = 0.0311 v(1, 3) = 0.9711
v0(0) = 0.7496 v0(1) = 0.3796 v0(2) = 0.7256 v0(3) = 0.1628
w(3) = 0.555 w0 = 0.9505
alfa = txtTrainRate.Text max_epoh = MaxEpoh target_Error = txtErr.Text Epoh = 0
kuadrat_Error_rerata = 0 pBar.Value = 30
For i = 0 To 99 v1(0, i) = Rnd(1) Next i
For i = 0 To 99 v21(0, i) = Rnd(1) Next i
Text3.Text = Text3.Text & "Bobot Awal Acak" & vbCrLf
For i = 0 To 99
v00(i) = Rnd(1) 'GetRand
Text3.Text = Text3.Text & i & " " & v00(i) & " " & vbCrLf Next i
i = 0
Dim strPiksel As String
Set rsCari = New ADODB.Recordset
rsCari.Open "Select * from Piksel", CN, 1, 2 If Not rsCari.EOF Then
Text3.Text = Text3.Text & "Input Piksel" & vbCrLf Text3.Text = Text3.Text & "---" & vbCrLf
Do While Not rsCari.EOF
strPiksel = strPiksel & "" & rsCari!Nilai
rsCari.MoveNext If rsCari.EOF Then Exit Do
End If Loop
Text3.Text = Text3.Text & strPiksel & vbCrLf End If
Set rsCari = Nothing
' v_in00(i) = v00(i) ' 'v_in00(i) = v00(Betha)
' Text3.Text = Text3.Text & i & " " & v_in00(i) & vbCrLf 'Next i
Do
Epoh = Epoh + 1 pBar.Value = Epoh
'Text3.Text = Text3.Text & "Epoh " & Epoh & vbCrLf For j = 0 To Ttarget - 1
'Vektor input ke hidden For i = 0 To InputNode100
v_in(i) = Sqr((v(0, i) - input1(j)) ^ 2) If v_in(i) = 0 Then v_in(i) = 1 v_in(i) = (v(0, i)) / v_in(i) Next i
i = 0 v_in(i) = 0 'Pengaktifan
For i = 0 To InputNode100
z_in(i) = v_in(i) + v0(i) + (v(0, i) * input1(j)) + (v(1, i) * input2(j)) Next i
i = 0 'Operasi
For i = 0 To HiddenNode6
z(i) = 1 / (1 + Exp(-1 * z_in(i))) z(i) = Round(z(i), 4)
Next i
'Fungsi Aktivasi 'Operasi
Y_in = w0 + (w(0) * z(0)) + (w(1) * z(1)) + (w(2) * z(2)) + (w(3) * z(3))
'Pengaktifan
y_akt = 1 / (1 + Exp(-1 * Y_in)) y_akt = Round(y_akt, 4)
per_Error = target(j) - y_akt kuadrat_Error = per_Error ^ 2
kuadrat_Error = Round(kuadrat_Error, 4)
kuadrat_Error_rerata = kuadrat_Error_rerata + kuadrat_Error delta_Error = per_Error * y_akt * (1 - y_akt)
For i = 0 To OutputNode8
delta_w0 = alfa * delta_Error
'Info err dari out put For i = 0 To OutputNode8 delta_in(i) = delta_Error * w(i) delta_in(i) = Round(delta_in(i), 5) Next i
'Info err dari hidden
For i = 0 To HiddenNode6
delta(i) = delta_in(i) * (1 / (1 + Exp(-1 * z(i)))) * (1 - (1 / (1 + Exp(-1 * z(i))))) delta(i) = Round(delta(i), 5)
Next i
'Perubahan bobot
For i = 0 To HiddenNode6
delta_v(0, i) = alfa * delta(i) * input1(j) delta_v(0, i) = Round(delta_v(0, i), 5) delta_v(1, i) = alfa * delta(i) * input2(j) delta_v(1, i) = Round(delta_v(1, i), 5) delta_v0(i) = alfa * delta(i)
delta_v0(i) = Round(delta_v0(i), 5) Next i
Dim jj As Integer ' If Epoh < 4 Then ' For i = 0 To 99 ' For jj = 0 To 99 ' DoEvents
' 'Text3.Text = Text3.Text & "Data ke " & j + 1 & "x=" & input1(i) & " x=" & input2(jj) & vbCrLf
' Next jj ' Next i ' End If
'Bobot akhir input ke hidden For i = 0 To OutputNode8 v(0, i) = v(0, i) + delta_v(0, i) v(0, i) = Round(v(0, i), 5) v(1, i) = v(1, i) + delta_v(1, i) v(1, i) = Round(v(1, i), 5) v0(i) = v0(i) + delta_v0(i) v0(i) = Round(v0(i), 5) w(i) = w(i) + delta_w(i) w(i) = Round(w(i), 5) If Epoh < 4 Then
' DoEvents
'Text3.Text = Text3.Text & "data ke " & i + 1 & "x1=" & input1(i) & " x2=" & input2(j) & vbCrLf
'Text3.Text = Text3.Text & "v1=" & v(0, i) & " v2=" & v(1, i) & " v0=" & v0(i) & " w=" & w(i) & vbCrLf
'Next i End If Next i
'Bobot akhir hidden ke output w0 = w0 + delta_w0
w0 = Round(w0, 5) Next j
pBar.Value = 100
kuadrat_Error_rerata = kuadrat_Error_rerata / max_epoh kuadrat_Error_rerata = Round(kuadrat_Error_rerata, 4)
'Text3.Text = Text3.Text & "kuadrat error rata2= " & kuadrat_Error_rerata & vbCrLf
If kuadrat_Error_rerata < target_Error Then GoTo Selesai
End If
Loop Until Epoh = max_epoh
Selesai:
For i = 0 To HiddenNode6
'Text3.Text = Text3.Text & "v1=" & v(0, i) & " v2=" & v(1, i) & " v0=" & v0(i) & " w=" & w(i) & vbCrLf
Next i
'Text3.Text = Text3.Text & "w0=" & w0 time.StopTimer
txtWaktu.Text = time.Elasped / 3600 Pic3.Visible = False
Picture2.Visible = False MsgBox "Proses selesai..." pBar.Visible = False cmdSave.Enabled = True cmdSave.SetFocus End Sub
Sub akhir() Call Reduksi Call Transposisi Call Set_Target End Sub
Sub Matriks_biner()
Dim i As Integer, j As Integer For Y = 0 To 99
i = Y
GreyColor = Greyscale(GetPixel(Picture1.hdc, X, Y)) mat_A(i, j) = Binari
Next X Next Y
Dim temp As Integer If optYa.Value = True Then For Y = 0 To 99
DoEvents i = Y
For X = 0 To 99 j = X
DoEvents
temp = mat_A(i, j) If temp = 0 Then
Text1.Text = Text1.Text + "1" Else
Text1.Text = Text1.Text + "0" End If
Next X
Text1.Text = Text1.Text & vbCrLf Next Y
ElseIf optTdk.Value = True Then For Y = 0 To 99
DoEvents i = Y
For X = 0 To 99 j = X
DoEvents
temp = mat_A(i, j) Next X
Next Y End If
Call Matriks_biner1
Picture1.AutoRedraw = True For Y = 0 To 99
i = Y
For X = 0 To 99 j = X
GreyColor = Greyscale(GetPixel(Picture1.hdc, X, Y)) mat_A1(i, j) = Binari
Next X
Picture1.Refresh Next Y
End Sub
Sub Matriks_biner1()
Dim strXY As String Dim aa As Integer
For Y = 0 To 99 Step 10 i = Y
For X = 0 To 99 Step 10 j = X
GreyColor = Greyscale(GetPixel(Pic2.hdc, X, Y)) mat_A1(i, j) = Binari
Next X
Next Y
For Y = 0 To 99 Step 10 i = Y
For X = 0 To 99 Step 10 j = X
temp = mat_A1(i, j) aa = aa + 1
If temp = 0 Then
Text1.Text = Text1.Text + "1" strXY = "1"
Else
Text1.Text = Text1.Text + "0" strXY = "0"
End If
List1.AddItem strXY
Set rsCari = New ADODB.Recordset rsCari.Open "Piksel", CN, 1, 2 rsCari.AddNew
rsCari.Fields("ID").Value = aa rsCari.Fields("Nilai") = strXY rsCari.Update
Set rsCari = Nothing Next X
Text1.Text = Text1.Text & vbCrLf Next Y
End Sub
Sub Reduksi()
Text1.Text = Text1.Text & vbCrLf
Dim i As Integer, j As Integer, k As Integer, l As Integer, m As Integer Dim hasil As Integer
Dim n As Integer i = 0
m = 0
For i = 1 To m For j = 0 To 9 n = mat_A(i, j) hasil = hasil + n mat_B(k, 0) = hasil Next j
Next i hasil = 0 For i = 1 To m For j = 10 To 19 n = mat_A(i, j) hasil = hasil + n mat_B(k, 1) = hasil Next j
Next i hasil = 0
For i = 1 To m For j = 20 To 29 n = mat_A(i, j) hasil = hasil + n mat_B(k, 2) = hasil Next j
Next i hasil = 0
For i = 1 To m For j = 30 To 39 n = mat_A(i, j) hasil = hasil + n mat_B(k, 3) = hasil Next j
Next i hasil = 0
For i = 1 To m For j = 40 To 49 n = mat_A(i, j) hasil = hasil + n mat_B(k, 4) = hasil Next j
Next i hasil = 0
Next j Next i hasil = 0
For i = 1 To m For j = 60 To 69 n = mat_A(i, j) hasil = hasil + n mat_B(k, 6) = hasil Next j
Next i hasil = 0
For i = 1 To m For j = 70 To 79 n = mat_A(i, j) hasil = hasil + n mat_B(k, 7) = hasil Next j
Next i hasil = 0
For i = 1 To m For j = 80 To 89 n = mat_A(i, j) hasil = hasil + n mat_B(k, 8) = hasil Next j
Next i hasil = 0
For i = 1 To m For j = 90 To 99 n = mat_A(i, j) hasil = hasil + n mat_B(k, 9) = hasil Next j
Next i hasil = 0 l = l + 10 Next k
Dim temp As Integer For Y = 0 To 9 i = Y
For X = 0 To 9 j = X
If (temp > 0) And (temp <= 100) Then Else
End If Next X Next Y End Sub
Sub Transposisi()
Dim i As Integer, j As Integer Dim temp, temp1 As Integer For Y = 0 To 1
For X = 0 To 9
temp = mat_B(Y, X) mat_C(X, Y) = temp Next X
Next Y
For Y = 2 To 3 For X = 0 To 9
temp = mat_B(Y, X)
mat_C(X + 10, Y - 2) = temp Next X
Next Y
For Y = 4 To 5 For X = 0 To 9
temp = mat_B(Y, X)
mat_C(X + 20, Y - 4) = temp Next X
Next Y
For Y = 6 To 7 For X = 0 To 9
temp = mat_B(Y, X)
mat_C(X + 30, Y - 6) = temp Next X
Next Y
For Y = 8 To 9 For X = 0 To 9
temp = mat_B(Y, X)
mat_C(X + 40, Y - 8) = temp Next X
Next Y
For Y = 0 To 49 i = Y
temp = mat_C(i, j)
If (temp > 0) And (temp < 100) Then temp1 = 1
mat_Input(i, j) = temp1 Else
temp1 = 0
mat_Input(i, j) = temp1 End If
Next X Next Y
pBar.Value = 20 End Sub
Sub Set_Target()
Dim temp1, temp2, temp3 As Integer
For Y = 0 To 49
temp1 = mat_Input(Y, 0) temp2 = mat_Input(Y, 1) temp3 = temp1 Or temp2 mat_target(Y) = temp3 Next Y
End Sub
Private Sub Form_Activate() cmdOpen.Enabled = True cmdProses.Enabled = False cmdTrain.Enabled = False cmdSave.Enabled = False cmdOpen.Enabled = True optTdk.Value = True pBar.Min = 0
pBar.Max = 100 pBar.Visible = False Call Bersih
'Call Segar End Sub
Private Sub Form_Load() Call Koneksi
Text4.Text = Text4.Text + "ASCII Code's" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "---" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "0 --> 00110000" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "2 --> 00110010" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "3 --> 00110011" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "4 --> 00110100" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "5 --> 00110101" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "6 --> 00110110" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "7 --> 00110111" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "8 --> 00111000" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "9 --> 00111001" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "A --> 01000001" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "B --> 01000010" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "C --> 01000011" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "D --> 01000100" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "E --> 01000101" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "F --> 01000110" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "G --> 01000111" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "H --> 01001000" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "I --> 01001001" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "J --> 01001010" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "K --> 01001011" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "M --> 01001101" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "N --> 01001110" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "O --> 01001111" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "P --> 01010000" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "Q --> 01010001" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "R --> 01010010" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "S --> 01010011" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "T --> 01010100" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "U --> 01010101" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "V --> 01010110" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "W --> 01010111" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "X --> 01011000" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "Y --> 01011001" Text4.Text = Text4.Text & vbCrLf
Text4.Text = Text4.Text + "Z --> 01011010" Text4.Text = Text4.Text & vbCrLf
End Sub
Private Sub txtTarget_Change() On Error Resume Next
If Len(txtTarget.Text) < 8 Then Exit Sub
Else
Dim liCount As Long Dim liCount2 As Integer Dim liValue As Integer Dim lsResult As String Dim lvArray(7) As Integer
For liCount = 1 To Len(txtTarget) Step 8 For liCount2 = 0 To 7
lsResult = lsResult & RevertBinary(lvArray) Next
lblTarget.Caption = lsResult cmdTrain.Enabled = True cmdTrain.SetFocus End If
End Sub
Function RevertBinary(ByRef SourceArray() As Integer) Dim int_Count As Integer
Dim Results As Integer On Error Resume Next
For int_Count = 0 To 7 Step 1 If int_Count < 7 Then
SourceArray(int_Count) = SourceArray(int_Count) * (2 ^ (7 - int_Count)) End If
Results = Results + SourceArray(int_Count) Next
RevertBinary = Chr(Results) End Function
Sub Resize()
Dim ImageWidth As Single Dim ImageHeight As Single Dim ResizedWidth As Single Dim ResizedHeight As Single Dim DestWidth As Single Dim DestHeight As Single Dim AspectRatio As Single DestWidth = 100
DestHeight = 100 ResizedWidth = 100 ResizedHeight = 100 AspectRatio = 1
Call AdjustImageDimensions(ResizedWidth, ResizedHeight, DestWidth, DestHeight) AspectRatio = (ResizedHeight / ResizedWidth)
Picture2.Cls
Picture2.PaintPicture ipc.Picture, 0, 0, ResizedWidth, ResizedHeight End Sub
Sub ResizeThin()
Dim ImageWidth As Single Dim ImageHeight As Single Dim ResizedWidth As Single Dim ResizedHeight As Single Dim DestWidth As Single Dim DestHeight As Single Dim AspectRatio As Single DestWidth = 100
ResizedWidth = 100 ResizedHeight = 100 AspectRatio = 1
Call AdjustImageDimensions(ResizedWidth, ResizedHeight, DestWidth, DestHeight) AspectRatio = (ResizedHeight / ResizedWidth)
Pic1.Cls
Pic1.PaintPicture Picture2.Picture, 0, 0, ResizedWidth, ResizedHeight 'Picture2.Visible = False
End Sub
Sub ResizeThin1()
Dim ImageWidth As Single Dim ImageHeight As Single Dim ResizedWidth As Single Dim ResizedHeight As Single Dim DestWidth As Single Dim DestHeight As Single Dim AspectRatio As Single DestWidth = 100
DestHeight = 100 ResizedWidth = 100 ResizedHeight = 100 AspectRatio = 1
Call AdjustImageDimensions(ResizedWidth, ResizedHeight, DestWidth, DestHeight) AspectRatio = (ResizedHeight / ResizedWidth)
Pic3.Cls
Pic3.PaintPicture ipc1.Picture, 0, 0, ResizedWidth, ResizedHeight ipc1.Visible = False
End Sub
Sub Resize1()
Dim ImageWidth As Single Dim ImageHeight As Single Dim ResizedWidth As Single Dim ResizedHeight As Single Dim DestWidth As Single Dim DestHeight As Single Dim AspectRatio As Single DestWidth = 100
DestHeight = 100 ResizedWidth = 100 ResizedHeight = 100 AspectRatio = 1
Call AdjustImageDimensions(ResizedWidth, ResizedHeight, DestWidth, DestHeight) AspectRatio = (ResizedHeight / ResizedWidth)
Pic3.Cls
Sub ResizeBin()
Dim ImageWidth As Single Dim ImageHeight As Single Dim ResizedWidth As Single Dim ResizedHeight As Single Dim DestWidth As Single Dim DestHeight As Single Dim AspectRatio As Single DestWidth = 100
DestHeight = 100 ResizedWidth = 100 ResizedHeight = 100 AspectRatio = 1
Call AdjustImageDimensions(ResizedWidth, ResizedHeight, DestWidth, DestHeight) AspectRatio = (ResizedHeight / ResizedWidth)
Pic2.Cls
Pic2.PaintPicture ipc.Picture, 0, 0, ResizedWidth, ResizedHeight ipc.Visible = False
End Sub
Option Explicit
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long
Dim R As Integer, G As Integer, B As Integer Dim X, Y, x1, x2, Y1, Y2, HX, HY As Integer Dim GreyColor, hasil As Integer
Dim Binari As Integer
Dim mat_A(100, 100) As Integer Dim mat_A1(200, 200) As Single Dim mat_B(10, 10) As Integer Dim mat_C(50, 2) As Integer Dim db_hasil(1, 100) As Integer Dim mat_Input(100, 2) As Integer
Dim mat_target(100), db_target(100), target(100), bobot1, bobot2 As Integer Dim input1(100) As Integer
Dim input2(100) As Integer Dim v00(100) As Double
Dim v(1, 3), v0(3), w(3), w0, z_in(3), z(3), Y_in, y_akt, delta_w(3) As Double Dim v_in(3) As Double
Dim v_inn(100) As Double Dim v_in00(100) As Double
Dim delta_in(3), delta(3), delta_v(1, 3), delta_v0(3), delta_w0 As Double Dim MaxEpoh As Integer
Dim v1(100, 100) As Double Dim v2(100, 100) As Double
Dim ID As Integer, ID_W As Integer, ID_W1 As Integer, ID_V0 As Integer, ID_V1 As Integer, ID_V2 As Integer, ID_W0 As Integer
Dim v01(100) As Double Dim v21(100, 100) As Double Dim w1(100) As Double Sub CariID()
ID = 0
txtNo.Text = ""
Set rsCari = New ADODB.Recordset
rsCari.Open "Select * from tData order by ID desc", CN, 1, 2 If Not rsCari.EOF Then
ID = rsCari!ID + 1 Else
ID = 1 End If
Set rsCari = Nothing txtNo.Text = ID
End Sub Sub Segar1() Dim j As ListItem lvData.ListItems.Clear
Set rsCari = New ADODB.Recordset
rsCari.Open "Select * from tData order by ID asc", CN, 1, 2 If Not rsCari.EOF Then
Do While Not rsCari.EOF ID = rsCari!ID
rsCari.MoveNext If rsCari.EOF Then Exit Do
End If Loop End If
End Sub Sub Segar() Dim j As ListItem lvData.ListItems.Clear lvData.ListItems.Clear Dim rsCari1 As Recordset Dim Nm As String
Set rsCari = New ADODB.Recordset
rsCari.Open "Select * from tDataV1 where Algo='Kombinasi' order by ID asc", CN, 1, 2
If Not rsCari.EOF Then Do While Not rsCari.EOF ID = rsCari!ID
Set rsCari1 = New ADODB.Recordset
rsCari1.Open "Select * from tData Where ID =" & ID & "", CN, 1, 2 If Not rsCari1.EOF Then
Nm = rsCari1!Nama Else
Nm = "-" End If
Set rsCari1 = Nothing
Set j = lvData.ListItems.Add(, , ID) j.SubItems(1) = Nm
j.SubItems(20) = rsCari!v119 j.SubItems(21) = rsCari!v120
rsCari.MoveNext If rsCari.EOF Then Exit Do
End If Loop End If
Set rsCari = Nothing End Sub
Sub Bersih() txtNo.Text = "" txtNama.Text = "" Text1.Text = "" Text3.Text = "" txtWaktu.Text = "" txtTarget.Text = "" lblTarget.Caption = "" txtTarget.Enabled = False Picture1.Picture = Nothing Pic1.Picture = Nothing ipc.Picture = Nothing ipc1.Picture = Nothing ipc2.Picture = Nothing Pic2.Picture = Nothing ipc.Visible = False ipc1.Visible = False ipc2.Visible = False Picture2.Visible = False
Set rsCari = New ADODB.Recordset
rsCari.Open "Delete from Piksel", CN, 1, 2 Set rsCari = Nothing
End Sub
Public Function Greyscale(ByVal Colr As Long) As Integer Dim R As Long, G As Long, B As Long
R = Colr Mod 256 Colr = Colr \ 256 G = Colr Mod 256 Colr = Colr \ 256 B = Colr Mod 256
'r = Colr And RGB(255, 0, 0)
'g = Int((Colr And RGB(0, 255, 0)) / 256)
'b = Int(Int((Colr And RGB(0, 0, 255)) / 256) / 256)
If G < 0 Then G = 0: If G > 255 Then G = 255 If B < 0 Then B = 0: If B > 255 Then B = 255
Greyscale = (76 * R) / 255 + 150 * G / 255 + 28 * B / 255 'Greyscale = (r + g + b) / 3
If Greyscale > 190 Then Greyscale = 255 Binari = 0 Else
Greyscale = 0 Binari = 1 End If
End Function Sub ProsessImage()
Picture1.AutoRedraw = True DoEvents
For Y = 0 To (Picture1.Height / Screen.TwipsPerPixelY) For X = 0 To (Picture1.Width / Screen.TwipsPerPixelX) GreyColor = Greyscale(GetPixel(Picture1.hdc, X, Y))
SetPixel Picture1.hdc, X, Y, RGB(GreyColor, GreyColor, GreyColor) Next X
Picture1.Refresh Next Y
End Sub
Private Sub cmdBersih_Click() Call Bersih
cmdOpen.Enabled = True cmdProses.Enabled = False cmdTrain.Enabled = False cmdSave.Enabled = False cmdOpen.Enabled = True End Sub
Private Sub cmdExit_Click() Unload Me
End Sub
Private Sub cmdOpen_Click() cd.Filter = "Image|*.bmp;*.jpg" cd.ShowOpen
Picture1.Cls
If cd.FileName = "" Then Exit Sub
Picture1.Picture = LoadPicture(cd.FileName) Picture1.AutoRedraw = True
Picture1.PaintPicture Picture1.Picture, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight
ipc1.Visible = True ipc2.Visible = True
ipc.Picture = LoadPicture(cd.FileName) ipc1.Picture = LoadPicture(cd.FileName) ipc2.Picture = LoadPicture(cd.FileName) Picture2.Visible = True
Call CariID
txtNama.Text = cd.FileTitle cmdProses.Enabled = True
End Sub
Private Sub cmdProses_Click() cmdOpen.Enabled = False cmdProses.Enabled = False Pic3.Visible = True
Picture2.Visible = True
Call Resize
ipc1.Visible = True
'ipc1.Picture = Pic2.Picture ipc1.Visible = True
ipc1.colnorm3 180 ipc1.scalesign 1.5
ipc1.filtersmooth ipc1.colnorm3 180 ipc1.getsign ipc1.Thin
Picture2.Picture = ipc1.Picture ipc1.Visible = False
ipc2.Visible = True ipc2.colnorm3 200 ipc2.scalesign 2 ipc2.filtersmooth
ipc2.colnorm3 180 ipc2.getsign
ipc2.Visible = False Call ResizeThin Call ResizeBin Call ProsessImage Call Matriks_biner pBar.Visible = True pBar.Value = 10
Private Sub cmdReset_Click() Dim X As String
X = MsgBox("Semua data training mau dihapus ?", vbYesNo) If X = vbYes Then
Set rsCari = New ADODB.Recordset
rsCari.Open "Delete from Piksel", CN, 1, 2 Set rsCari = Nothing
Set rsCari = New ADODB.Recordset
rsCari.Open "Delete from tDataV1 where Algo = 'Kombinasi'", CN, 1, 2 Set rsCari = Nothing
Set rsCari = New ADODB.Recordset
rsCari.Open "Delete from tDataV2 where Algo = 'Kombinasi'", CN, 1, 2 Set rsCari = Nothing
Set rsCari = New ADODB.Recordset
rsCari.Open "Delete from tData where Algo = 'Kombinasi'", CN, 1, 2 Set rsCari = Nothing
'Call Segar Else
Exit Sub End If End Sub
Private Sub cmdSave_Click() cmdSave.Enabled = False
If (txtNo.Text = "") Or (txtNama.Text = "") Then MsgBox "Isi data"
Exit Sub End If
Set rsCari = New ADODB.Recordset rsCari.Open "tData", CN, 1, 2 rsCari.AddNew
rsCari.Fields("ID").Value = txtNo.Text rsCari.Fields("nama").Value = txtNama.Text Dim i As Integer
For i = 0 To 3
rsCari.Fields("v1" & i + 1).Value = v(0, i) rsCari.Fields("v2" & i + 1).Value = v(1, i) rsCari.Fields("v0" & i + 1).Value = v0(i) rsCari.Fields("w" & i + 1).Value = w(i) Next i
rsCari.Fields("w0").Value = w0 For i = 0 To 49
Next i
rsCari.Fields("target").Value = txtTarget.Text rsCari.Fields("Algo").Value = "Kombinasi" rsCari.Update
Set rsCari = Nothing
ID_V1 = 0
Set rsCari = New ADODB.Recordset
rsCari.Open "Select * from tDataV1 order by ID desc", CN, 1, 2 If Not rsCari.EOF Then
ID_V1 = rsCari!ID + 1 Else
ID_V1 = 1 End If
Set rsCari = Nothing
Set rsCari = New ADODB.Recordset rsCari.Open "tDataV1", CN, 1, 2 rsCari.AddNew
rsCari.Fields("ID").Value = ID_V1 For i = 0 To 99
rsCari.Fields("v1" & i + 1).Value = v1(0, i) Next i
rsCari!Algo = "Kombinasi" rsCari.Update
Set rsCari = Nothing
ID_V2 = 0
Set rsCari = New ADODB.Recordset
rsCari.Open "Select * from tDataV2 order by ID desc", CN, 1, 2 If Not rsCari.EOF Then
ID_V2 = rsCari!ID + 1 Else
ID_V2 = 1 End If
Set rsCari = Nothing
Set rsCari = New ADODB.Recordset rsCari.Open "tDataV2", CN, 1, 2 rsCari.AddNew
rsCari.Fields("ID").Value = ID_V2 For i = 0 To 99
rsCari.Fields("v2" & i + 1).Value = v21(0, i) Next i
rsCari!Algo = "Kombinasi" rsCari.Update
'Call Segar Call Bersih
MsgBox "Data sdh disimpan" End Sub
Private Sub cmdTrain_Click() Dim Epoch100 As Integer Epoch100 = 100
cmdTrain.Enabled = False Call akhir
Dim temp1, temp2, temp3, Epoh, max_epoh, hitung, i, j As Integer
Dim alfa, target_Error, per_Error, kuadrat_Error, delta_Error, kuadrat_Error_rerata As Double
MaxEpoh = Epoh100 time.StartTimer For i = 0 To MaxEpoh temp1 = mat_Input(i, 0) input1(i) = temp1 temp2 = mat_Input(i, 1) input2(i) = temp2 temp3 = mat_target(i) target(i) = temp3 Next i
i = 0
v(0, 0) = 0.9562 v(0, 1) = 0.7762 v(0, 2) = 0.1623 v(0, 3) = 0.2886
v(1, 0) = 0.1962 v(1, 1) = 0.6133 v(1, 2) = 0.0311 v(1, 3) = 0.9711
v0(0) = 0.7496 v0(1) = 0.3796 v0(2) = 0.7256 v0(3) = 0.1628
w(0) = 0.228 w(1) = 0.9585 w(2) = 0.6799 w(3) = 0.555 w0 = 0.9505
target_Error = txtErr.Text Epoh = 0
kuadrat_Error_rerata = 0 pBar.Value = 30
Betha = 0.7 * (6 ^ (1 / 100))
Text3.Text = Text3.Text & "Betha: " & Betha & vbCrLf
For i = 0 To 99 v1(0, i) = Rnd(1) Next i
For i = 0 To 99 v21(0, i) = Rnd(1) Next i
Text3.Text = Text3.Text & "Bobot Awal Acak" & vbCrLf
For i = 0 To 99
v00(i) = Rnd(1) 'GetRand
Text3.Text = Text3.Text & i & " " & v00(i) & " " & vbCrLf Next i
i = 0
For i = 0 To 99
v_in00(i) = v_in00(i) + v00(i) ^ 2 v_in00(i) = Sqr(v_in00(i)) v_in00(i) = Round(v_in00(i), 4) Next i
For i = 0 To 99
v_inn(i) = (v_in00(i) * Betha) / Rnd(i) v_inn(i) = Round((v_inn(i)), 4)
Text3.Text = Text3.Text & v_inn(i) & vbCrLf Next i
Dim strPiksel As String
Set rsCari = New ADODB.Recordset
rsCari.Open "Select * from Piksel", CN, 1, 2 If Not rsCari.EOF Then
Text3.Text = Text3.Text & "Input Piksel" & vbCrLf Text3.Text = Text3.Text & "---" & vbCrLf
Do While Not rsCari.EOF
strPiksel = strPiksel & "" & rsCari!Nilai
Exit Do End If Loop
Text3.Text = Text3.Text & strPiksel & vbCrLf End If
Set rsCari = Nothing
Text3.Text = Text3.Text & "Bobot Awal Acak Inisialisasi" & vbCrLf Text3.Text = Text3.Text & "---" & vbCrLf For i = 0 To 99
v_in00(i) = v00(i) * Betha 'v_in00(i) = v00(Betha)
Text3.Text = Text3.Text & i & " " & v_in00(i) & vbCrLf Next i
Do
Epoh = Epoh + 1 pBar.Value = Epoh
'Text3.Text = Text3.Text & "Epoh " & Epoh & vbCrLf For j = 0 To Ttarget - 1
'Vektor input ke hidden For i = 0 To InputNode100
v_in(i) = Sqr((v(0, i) - input1(j)) ^ 2) If v_in(i) = 0 Then v_in(i) = 1 v_in(i) = (v(0, i) * Betha) / v_in(i) Next i
i = 0 v_in(i) = 0
'Pengaktifan
For i = 0 To InputNode100
z_in(i) = v_in(i) + v0(i) + (v(0, i) * input1(j)) + (v(1, i) * input2(j)) Next i
i = 0 'Operasi
For i = 0 To HiddenNode6
z(i) = 1 / (1 + Exp(-1 * z_in(i))) z(i) = Round(z(i), 4)
Next i
'Fungsi Aktivasi 'Operasi
Y_in = w0 + (w(0) * z(0)) + (w(1) * z(1)) + (w(2) * z(2)) + (w(3) * z(3))
'Pengaktifan
per_Error = target(j) - y_akt kuadrat_Error = per_Error ^ 2
kuadrat_Error = Round(kuadrat_Error, 4)
kuadrat_Error_rerata = kuadrat_Error_rerata + kuadrat_Error delta_Error = per_Error * y_akt * (1 - y_akt)
For i = 0 To OutputNode8
delta_w(i) = alfa * delta_Error * z(i) delta_w(i) = Round(delta_w(i), 5) Next i
delta_w0 = alfa * delta_Error
'Info err dari out put For i = 0 To OutputNode8 delta_in(i) = delta_Error * w(i) delta_in(i) = Round(delta_in(i), 5) Next i
'Info err dari hidden
For i = 0 To HiddenNode6
delta(i) = delta_in(i) * (1 / (1 + Exp(-1 * z(i)))) * (1 - (1 / (1 + Exp(-1 * z(i))))) delta(i) = Round(delta(i), 5)
Next i
'Perubahan bobot
For i = 0 To HiddenNode6
delta_v(0, i) = alfa * delta(i) * input1(j) delta_v(0, i) = Round(delta_v(0, i), 5) delta_v(1, i) = alfa * delta(i) * input2(j) delta_v(1, i) = Round(delta_v(1, i), 5) delta_v0(i) = alfa * delta(i)
delta_v0(i) = Round(delta_v0(i), 5) Next i
Dim jj As Integer ' If Epoh < 4 Then ' For i = 0 To 99 ' For jj = 0 To 99 ' DoEvents
' 'Text3.Text = Text3.Text & "Data ke " & j + 1 & "x=" & input1(i) & " x=" & input2(jj) & vbCrLf
' Next jj ' Next i ' End If
For i = 0 To OutputNode8 v(0, i) = v(0, i) + delta_v(0, i) v(0, i) = Round(v(0, i), 5) v(1, i) = v(1, i) + delta_v(1, i) v(1, i) = Round(v(1, i), 5) v0(i) = v0(i) + delta_v0(i) v0(i) = Round(v0(i), 5) w(i) = w(i) + delta_w(i) w(i) = Round(w(i), 5) If Epoh < 4 Then 'For i = 0 To 99 ' DoEvents
'Text3.Text = Text3.Text & "data ke " & i + 1 & "x1=" & input1(i) & " x2=" & input2(j) & vbCrLf
'Text3.Text = Text3.Text & "v1=" & v(0, i) & " v2=" & v(1, i) & " v0=" & v0(i) & " w=" & w(i) & vbCrLf
'Next i End If Next i
'Bobot akhir hidden ke output w0 = w0 + delta_w0
w0 = Round(w0, 5) Next j
pBar.Value = 100
kuadrat_Error_rerata = kuadrat_Error_rerata / max_epoh kuadrat_Error_rerata = Round(kuadrat_Error_rerata, 4)
'Text3.Text = Text3.Text & "kuadrat error rata2= " & kuadrat_Error_rerata & vbCrLf
If kuadrat_Error_rerata < target_Error Then GoTo Selesai
End If
Loop Until Epoh = max_epoh
Selesai:
For i = 0 To HiddenNode6
'Text3.Text = Text3.Text & "v1=" & v(0, i) & " v2=" & v(1, i) & " v0=" & v0(i) & " w=" & w(i) & vbCrLf
Next i
'Text3.Text = Text3.Text & "w0=" & w0 time.StopTimer
txtWaktu.Text = time.Elasped / 3600 Pic3.Visible = False
Sub akhir() Call Reduksi Call Transposisi Call Set_Target End Sub
Sub Matriks_biner()
Dim i As Integer, j As Integer For Y = 0 To 99
i = Y
For X = 0 To 99 j = X
GreyColor = Greyscale(GetPixel(Picture1.hdc, X, Y)) mat_A(i, j) = Binari
Next X Next Y
Dim temp As Integer If optYa.Value = True Then For Y = 0 To 99
DoEvents i = Y
For X = 0 To 99 j = X
DoEvents
temp = mat_A(i, j) If temp = 0 Then
Text1.Text = Text1.Text + "1" Else
Text1.Text = Text1.Text + "0" End If
Next X
Text1.Text = Text1.Text & vbCrLf Next Y
ElseIf optTdk.Value = True Then For Y = 0 To 99
DoEvents i = Y
For X = 0 To 99 j = X
DoEvents
temp = mat_A(i, j) Next X
Next Y End If
Call Matriks_biner1
Picture1.AutoRedraw = True For Y = 0 To 99