First Semester
Session 2014/2015
(A141)
Assignment 3
Perceptron
Name
Sivashankari D/O Sivanantham
220215
Submitted by
Date 17th November 2014
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
1.0 TITLE
The simple perceptron learning algorithms to initialize weight and bias with
activation functions. The output produced for computing the AND function with
binary inputs and bipolar target.
2.0
OBJECTIVE
To generate the truth table by using a simple perceptron.
To calculate the AND function with binary inputs and bipolar target.
Assume that the initial value for wi, w2 and b = 0, = 1 and
.
When x1=1 and x2=1, the separating lines become
X1 + x2 +1 = 0.2
And
X1 + x2 +1 = -0.2
In addition, when x1 = 1 and x2 =0, the separating lines become
X2 - 1 = 0.2
And
X2 - 1 = - 0.2
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
3.0 Interface Design
LABEL
TEXT BOX
BUTTON
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
Tools
LABEL 1
Properties and its description
Name : X1
Back Color : Alice Blue
Font : 20th century
Size : 12
Fore Color : Red
LABEL 2
Name : X2
Back Color : Alice Blue
Font : 20th century
Size : 12
Fore Color : Red
LABEL 3
Name : target
Back Color : Alice Blue
Font : 20th century
Size : 12
Fore Color : Red
LABEL4
Name : Y_in
Back Color : Alice Blue
Font : 20th century
Size : 12
Fore Color : Red
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
LABEL 5
Name : Y_out
Back Color : Alice Blue
Font : 20th century
Size : 12
Fore Color : Red
LABEL 6
Name : New_w1
Back Color : Alice Blue
Font : 20th century
Size : 12
Fore Color : Red
LABEL 7
Name : New_w2
Back Color : Alice Blue
Font : 20th century
Size : 12
Fore Color : Red
LABEL 17
Name : New_Bias
Back Color : Alice Blue
Font : 20th century
Size : 12
Fore Color : Red
LABEL 20
Name : W2
Back Color : Alice Blue
Font : 20th century
Size : 12
Fore Color : Red
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
Name : W1
LABEL 21
Back Color : Alice Blue
Font : 20th century
Size : 12
Fore Color : Red
LABEL 19
Name : bias
Back Color : Alice Blue
Font : 20th century
Size : 12
Fore Color : Red
LABEL 16
Name :Input
Back Color : AliceBlue
Font : Budmo Jiggler
Size : 12
Fore Color : DeepPink
LABEL 13
Name :Output
Back Color : AliceBlue
Font : Budmo Jiggler
Size : 12
Fore Color : DeepPink
LABEL 14
Name : Weight changes
Back Color : AliceBlue
Font : Budmo Jiggler
Size : 12
Fore Color : DeepPink
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
Name : weights
LABEL 18
Back Color : AliceBlue
Font : Budmo Jiggler
Size : 12
Fore Color : DeepPink
LABEL 15
Name :Array
Back Color : AliceBlue
Font : Showgard Gothic
Size : 18
Fore Color : DarkOrchid
TEXT BOX
Back Color : Orange
Font : Wide Latin
Size : 12
Fore Color : Black
Border Style : Fixed3D
TEXT BOX
Back Color : Light purple
Font : Wide Latin
Size : 12
Fore Color : Black
Border Style : Fixed3D
TEXT BOX
Back Color : Terquise
Font : Wide Latin
Size : 12
Fore Color : Black
Border Style : Fixed3D
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
TEXT BOX
Back Color : Silver
Font : Wide Latin
Size : 12
Fore Color : Black
Border Style : Fixed3D
BUTTON
Font : Budmo Jiggler
Size : 12
Fore Color : Control Text
Text Align : Middle Center
Flat Style : Standard
BUTTON
Font : Budmo Jiggler
Size : 12
Fore Color : Control Text
Text Align : Middle Center
Flat Style : Standard
BUTTON
Font : Budmo Jiggler
Size : 12
Fore Color : Control Text
Text Align : Middle Center
Flat Style : Standard
BUTTON
Font : Budmo Jiggler
Size : 12
Fore Color : Control Text
Text Align : Middle Center
Flat Style : Standard
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
Coding
Public Class ArrayForm
Dim x1(4), x2(4) As Integer
Dim bias_input As Integer
Dim target_output(4) As Integer
Dim Y_in(4) As Single
Dim Y_out(4) As Single
Dim New_weight1(4), New_weight2(4), New_bias(4) As Single
Dim IB, IW1, IW2 As Integer
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
[Link]
'Local Declaration'
Dim i, A, T As Integer
Dim Weight1(4), Weight2(4), bias_weight(4) As Integer
'initialization of variable'
IB = 0
IW1 = 0
IW2 = 0
A = 1
T = 0.2
bias_input = 1
'Store input into Array x1,x2,target_out and bias_input'
x1(0) = CInt([Link])
x1(1) = CInt([Link])
x1(2) = CInt([Link])
x1(3) = CInt([Link])
x2(0)
x2(1)
x2(2)
x2(3)
=
=
=
=
CInt([Link])
CInt([Link])
CInt([Link])
CInt([Link])
target_output(0)
target_output(1)
target_output(2)
target_output(3)
B_in1.Text
B_in2.Text
B_in3.Text
B_in4.Text
=
=
=
=
=
=
=
=
CInt([Link])
CInt([Link])
CInt([Link])
CInt([Link])
bias_input
bias_input
bias_input
bias_input
'Calculation of Weight changes and new_bias.'
For i = 0 To 3
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
bias_weight(0) =
New_weight1(i) =
New_weight2(i) =
New_bias(i) = IB
IB
IW1 + (A * target_output(i) * x1(i))
IW2 + (A * target_output(i) * x2(i))
+ (A * target_output(i))
Weight1(0) = New_weight1(0)
Weight2(0) = New_weight2(0)
bias_weight(0) = New_bias(0)
Y_in(0) = IB + x1(0) * IW1 + x2(0) * IW2
'weight changes calculation and bias_weight.'
If (i > 0) Then
Weight1(i) = New_weight1(i) + Weight1(i - 1)
Weight2(i) = New_weight2(i) + Weight2(i - 1)
bias_weight(i) = New_bias(i) + bias_weight(i - 1)
Y_in(i) = bias_weight(i - 1) + x1(i) * Weight1(i - 1) +
x2(i) * Weight2(i - 1)
'Apply Activation function: Calculate Y_out.'
If Y_in(i) > T Then
Y_out(i) = 1
ElseIf Y_in(i) <= -T Then
Y_out(i) = -1
Else
Y_out(i) = 0
End If
If (Y_out(i) = target_output(i)) Then
New_weight1(i) = IW1
New_weight2(i) = IW2
New_bias(i) = 0
bias_weight(i) = bias_weight(i - 1)
End If
End If
Next
'Display Y_in Values to textbox.'
[Link] = Y_in(0)
[Link] = Y_in(1)
[Link] = Y_in(2)
[Link] = Y_in(3)
For i = 0 To 3
Next
'Display Y_out
Y_output1.Text
Y_output2.Text
Y_output3.Text
values into Textbox'
= Y_out(0)
= Y_out(1)
= Y_out(2)
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
Y_output4.Text = Y_out(3)
'Display weight changes and new bias'
[Link] = New_weight1(0)
[Link] = New_weight1(1)
[Link] = New_weight1(2)
[Link] = New_weight1(3)
[Link]
[Link]
[Link]
[Link]
=
=
=
=
New_weight2(0)
New_weight2(1)
New_weight2(2)
New_weight2(3)
[Link]
[Link]
[Link]
[Link]
=
=
=
=
New_bias(0)
New_bias(1)
New_bias(2)
New_bias(3)
'Display initial weight1, weight2 and bias_weight.'
[Link] = IW1
[Link] = IW2
[Link] = IB
'display weight
[Link] =
[Link] =
[Link] =
[Link] =
update and bias_weight'
Weight1(0)
Weight1(1)
Weight1(2)
Weight1(3)
[Link]
[Link]
[Link]
[Link]
Weight2(0)
Weight2(1)
Weight2(2)
Weight2(3)
[Link]
[Link]
[Link]
[Link]
=
=
=
=
=
=
=
=
bias_weight(0)
bias_weight(1)
bias_weight(2)
bias_weight(3)
End Sub
'EPOCH_2 CALCULATIONS'
Private Sub Button1_Click_1(sender As Object, e As EventArgs)
Handles [Link]
'Local Declaration'
Dim i, A, T As Integer
Dim Weight1(4), Weight2(4), bias_weight(4) As Integer
'initialization of variable'
IB = -1
IW1 = 0
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
IW2 = 0
A = 1
T = 0.2
bias_input = 1
'Store input into Array x1,x2,target_out and bias_input'
x1(0) = CInt([Link])
x1(1) = CInt([Link])
x1(2) = CInt([Link])
x1(3) = CInt([Link])
x2(0)
x2(1)
x2(2)
x2(3)
=
=
=
=
CInt([Link])
CInt([Link])
CInt([Link])
CInt([Link])
target_output(0)
target_output(1)
target_output(2)
target_output(3)
B_in1.Text
B_in2.Text
B_in3.Text
B_in4.Text
=
=
=
=
=
=
=
=
CInt([Link])
CInt([Link])
CInt([Link])
CInt([Link])
bias_input
bias_input
bias_input
bias_input
'Calculation of Weight changes and new_bias.'
For i = 0 To 3
New_weight1(i) = IW1 + (A * target_output(i) * x1(i))
New_weight2(i) = IW2 + (A * target_output(i) * x2(i))
New_bias(i) = (A * target_output(i))
Weight1(0) = New_weight1(0)
Weight2(0) = New_weight2(0)
bias_weight(0) = IB + New_bias(0)
Y_in(0) = IB + x1(0) * IW1 + x2(0) * IW2
'weight changes calculation and bias_weight.'
If (i > 0) Then
Weight1(i) = New_weight1(i) + Weight1(i - 1)
Weight2(i) = New_weight2(i) + Weight2(i - 1)
bias_weight(i) = New_bias(i) + bias_weight(i - 1)
Y_in(i) = bias_weight(i - 1) + x1(i) * Weight1(i - 1) +
x2(i) * Weight2(i - 1)
If (Y_out(i) = target_output(i)) Then
New_weight1(i) = IW1
New_weight2(i) = IW2
New_bias(i) = 0
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
bias_weight(i) = bias_weight(i - 1)
End If
End If
'Apply Activation function: Calculate Y_out.'
If Y_in(i) > T Then
Y_out(i) = 1
ElseIf Y_in(i) < -T Then
Y_out(i) = -1
Else
Y_out(i) = 0
End If
'Display Y_in Values.'
Next
[Link] = Y_in(0)
[Link] = Y_in(1)
[Link] = Y_in(2)
[Link] = Y_in(3)
For i = 0 To 3
Next
'Display Y_out
Y_output1.Text
Y_output2.Text
Y_output3.Text
Y_output4.Text
values into Textbox'
= Y_out(0)
= Y_out(1)
= Y_out(2)
= Y_out(3)
'Display weight changes and new bias'
[Link] = New_weight1(0)
[Link] = New_weight1(1)
[Link] = New_weight1(2)
[Link] = New_weight1(3)
[Link]
[Link]
[Link]
[Link]
=
=
=
=
[Link]
[Link]
[Link]
[Link]
New_weight2(0)
New_weight2(1)
New_weight2(2)
New_weight2(3)
=
=
=
=
New_bias(0)
New_bias(1)
New_bias(2)
New_bias(3)
'Display initial weight1, weight2 and bias_weight.'
[Link] = IW1
[Link] = IW2
[Link] = IB
'display weight update and bias_weight'
[Link] = Weight1(0)
[Link] = Weight1(1)
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
[Link] = Weight1(2)
[Link] = Weight1(3)
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
=
=
=
=
=
=
=
=
Weight2(0)
Weight2(1)
Weight2(2)
Weight2(3)
bias_weight(0)
bias_weight(1)
bias_weight(2)
bias_weight(3)
End Sub
Private Sub ClearButton_Click(sender As Object, e As EventArgs)
Handles [Link]
[Link]
[Link]
[Link]
[Link]
=
=
=
=
""
""
""
""
[Link]
[Link]
[Link]
[Link]
=
=
=
=
""
""
""
""
B_in1.Text
B_in2.Text
B_in3.Text
B_in4.Text
""
""
""
""
=
=
=
=
[Link]
[Link]
[Link]
[Link]
=
=
=
=
""
""
""
""
[Link] = ""
[Link] = ""
[Link] = ""
[Link]
[Link]
[Link]
[Link]
=
=
=
=
""
""
""
""
Y_output1.Text
Y_output2.Text
Y_output3.Text
Y_output4.Text
=
=
=
=
""
""
""
""
[Link] = ""
[Link] = ""
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
[Link] = ""
[Link] = ""
[Link]
[Link]
[Link]
[Link]
=
=
=
=
""
""
""
""
[Link]
[Link]
[Link]
[Link]
=
=
=
=
""
""
""
""
[Link]
[Link]
[Link]
[Link]
=
=
=
=
""
""
""
""
[Link]
[Link]
[Link]
[Link]
=
=
=
=
""
""
""
""
[Link]
[Link]
[Link]
[Link]
=
=
=
=
""
""
""
""
End Sub
Private Sub CloseButton_Click(sender As Object, e As EventArgs)
Handles [Link]
Close()
End Sub
End Class
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
Test Run
EPOCH 1
EPOCH 2
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
Source Code Listing
Public Class ArrayForm
Dim x1(4), x2(4) As Integer
Dim bias_input As Integer
Dim target_output(4) As Integer
Dim Y_in(4) As Single
Dim Y_out(4) As Single
Dim New_weight1(4), New_weight2(4), New_bias(4) As Single
Dim IB, IW1, IW2 As Integer
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
[Link]
'Local Declaration'
Dim i, A, T As Integer
Dim Weight1(4), Weight2(4), bias_weight(4) As Integer
'initialization of variable'
IB = 0
IW1 = 0
IW2 = 0
A = 1
T = 0.2
bias_input = 1
'Store input into Array x1,x2,target_out and bias_input'
x1(0) = CInt([Link])
x1(1) = CInt([Link])
x1(2) = CInt([Link])
x1(3) = CInt([Link])
x2(0)
x2(1)
x2(2)
x2(3)
=
=
=
=
CInt([Link])
CInt([Link])
CInt([Link])
CInt([Link])
target_output(0)
target_output(1)
target_output(2)
target_output(3)
B_in1.Text
B_in2.Text
B_in3.Text
B_in4.Text
=
=
=
=
=
=
=
=
CInt([Link])
CInt([Link])
CInt([Link])
CInt([Link])
bias_input
bias_input
bias_input
bias_input
'Weight changes and new bias calculation'
For i = 0 To 3
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
bias_weight(0) =
New_weight1(i) =
New_weight2(i) =
New_bias(i) = IB
IB
IW1 + (A * target_output(i) * x1(i))
IW2 + (A * target_output(i) * x2(i))
+ (A * target_output(i))
Weight1(0) = New_weight1(0)
Weight2(0) = New_weight2(0)
bias_weight(0) = New_bias(0)
Y_in(0) = New_bias(0) + x1(0) * IW1 + x2(0) * IW2
If (i > 0) Then
'weight update calculation'
Weight1(i) = New_weight1(i) + Weight1(i - 1)
Weight2(i) = New_weight2(i) + Weight2(i - 1)
bias_weight(i) = New_bias(i) + bias_weight(i - 1)
'Y_in calculation'
Y_in(i) = bias_weight(i - 1) + x1(i) * Weight1(i - 1) + x2(i) *
Weight2(i - 1)
'Y_out calculation and condition'
If Y_in(i) > T Then
Y_out(i) = 1
ElseIf Y_in(i) <= -T Then
Y_out(i) = -1
Else
Y_out(i) = 0
End If
'weight changes and bias changes if Target = Y_out: weight_change
= initial weight'
If (Y_out(i) = target_output(i)) Then
New_weight1(i) = IW1
New_weight2(i) = IW2
New_bias(i) = 0
bias_weight(i) = bias_weight(i - 1)
End If
End If
Next
'Display Y_in value'
[Link] = Y_in(0)
[Link] = Y_in(1)
[Link] = Y_in(2)
[Link] = Y_in(3)
For i = 0 To 3
Next
'Display Y_out values into Textbox'
Y_output1.Text = Y_out(0)
Y_output2.Text = Y_out(1)
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
Y_output3.Text = Y_out(2)
Y_output4.Text = Y_out(3)
'Display Weight changes and bias output.'
[Link] = New_weight1(0)
[Link] = New_weight1(1)
[Link] = New_weight1(2)
[Link] = New_weight1(3)
[Link]
[Link]
[Link]
[Link]
=
=
=
=
[Link]
[Link]
[Link]
[Link]
New_weight2(0)
New_weight2(1)
New_weight2(2)
New_weight2(3)
=
=
=
=
New_bias(0)
New_bias(1)
New_bias(2)
New_bias(3)
'Display initial weight1, weight2 and initial bias_weight.'
[Link] = IW1
[Link] = IW2
[Link] = IB
'display weight
[Link] =
[Link] =
[Link] =
[Link] =
update and bias_weight'
Weight1(0)
Weight1(1)
Weight1(2)
Weight1(3)
[Link]
[Link]
[Link]
[Link]
Weight2(0)
Weight2(1)
Weight2(2)
Weight2(3)
[Link]
[Link]
[Link]
[Link]
=
=
=
=
=
=
=
=
bias_weight(0)
bias_weight(1)
bias_weight(2)
bias_weight(3)
End Sub
Private Sub ClearButton_Click(sender As Object, e As EventArgs) Handles
[Link]
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
[Link] = ""
B_in1.Text
B_in2.Text
B_in3.Text
B_in4.Text
=
=
=
=
[Link]
[Link]
[Link]
[Link]
""
""
""
""
=
=
=
=
""
""
""
""
[Link] = ""
[Link] = ""
[Link] = ""
[Link]
[Link]
[Link]
[Link]
=
=
=
=
""
""
""
""
[Link]
[Link]
[Link]
[Link]
=
=
=
=
""
""
""
""
[Link]
[Link]
[Link]
[Link]
=
=
=
=
""
""
""
""
[Link]
[Link]
[Link]
[Link]
=
=
=
=
""
""
""
""
End Sub
Private Sub CloseButton_Click(sender As Object, e As EventArgs) Handles
[Link]
Close()
End Sub
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles
[Link]
'Local Declaration'
Dim i, A, T As Integer
Dim Weight1(4), Weight2(4), bias_weight(4) As Integer
'initialization of variable'
IB = -1
IW1 = 0
IW2 = 0
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
A = 1
T = 0.2
bias_input = 1
'Store input into Array x1,x2,target_out and bias_input'
x1(0) = CInt([Link])
x1(1) = CInt([Link])
x1(2) = CInt([Link])
x1(3) = CInt([Link])
x2(0)
x2(1)
x2(2)
x2(3)
=
=
=
=
CInt([Link])
CInt([Link])
CInt([Link])
CInt([Link])
target_output(0)
target_output(1)
target_output(2)
target_output(3)
B_in1.Text
B_in2.Text
B_in3.Text
B_in4.Text
=
=
=
=
=
=
=
=
CInt([Link])
CInt([Link])
CInt([Link])
CInt([Link])
bias_input
bias_input
bias_input
bias_input
'Weight changes and new bias calculation'
For i = 0 To 3
bias_weight(0) = IB
New_weight1(i) = IW1 + (A * target_output(i) * x1(i))
New_weight2(i) = IW2 + (A * target_output(i) * x2(i))
New_bias(i) = IB + (A * target_output(i))
Weight1(0) = New_weight1(0)
Weight2(0) = New_weight2(0)
bias_weight(0) = New_bias(0)
Y_in(0) = New_bias(0) + x1(0) * IW1 + x2(0) * IW2
If (i > 0) Then
'weight update calculation'
Weight1(i) = New_weight1(i) + Weight1(i - 1)
Weight2(i) = New_weight2(i) + Weight2(i - 1)
bias_weight(i) = New_bias(i) + bias_weight(i - 1)
'Y_in calculation'
Y_in(i) = bias_weight(i - 1) + x1(i) * Weight1(i - 1) + x2(i) *
Weight2(i - 1)
'Y_out calculation and condition'
If Y_in(i) > T Then
Y_out(i) = 1
ElseIf Y_in(i) <= -T Then
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
Y_out(i) = -1
Else
Y_out(i) = 0
End If
'weight changes and bias changes if Target = Y_out: weight_change
= initial weight'
If (Y_out(i) = target_output(i)) Then
New_weight1(i) = IW1
New_weight2(i) = IW2
New_bias(i) = 0
bias_weight(i) = bias_weight(i - 1)
End If
End If
Next
'Display Y_in value'
[Link] = Y_in(0)
[Link] = Y_in(1)
[Link] = Y_in(2)
[Link] = Y_in(3)
For i = 0 To 3
Next
'Display Y_out
Y_output1.Text
Y_output2.Text
Y_output3.Text
Y_output4.Text
values into Textbox'
= Y_out(0)
= Y_out(1)
= Y_out(2)
= Y_out(3)
'Display Weight changes and bias output.'
[Link] = New_weight1(0)
[Link] = New_weight1(1)
[Link] = New_weight1(2)
[Link] = New_weight1(3)
[Link]
[Link]
[Link]
[Link]
=
=
=
=
[Link]
[Link]
[Link]
[Link]
New_weight2(0)
New_weight2(1)
New_weight2(2)
New_weight2(3)
=
=
=
=
New_bias(0)
New_bias(1)
New_bias(2)
New_bias(3)
'Display initial weight1, weight2 and initial bias_weight.'
[Link] = IW1
[Link] = IW2
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??
[Link] = IB
'display weight
[Link] =
[Link] =
[Link] =
[Link] =
update and bias_weight'
Weight1(0)
Weight1(1)
Weight1(2)
Weight1(3)
[Link]
[Link]
[Link]
[Link]
Weight2(0)
Weight2(1)
Weight2(2)
Weight2(3)
[Link]
[Link]
[Link]
[Link]
End Sub
=
=
=
=
=
=
=
=
bias_weight(0)
bias_weight(1)
bias_weight(2)
bias_weight(3)
Private Sub Label15_Click(sender As Object, e As EventArgs) Handles
[Link]
End Sub
Private Sub Label16_Click(sender As Object, e As EventArgs) Handles
[Link]
End Sub
Private Sub TextBox17_TextChanged(sender As Object, e As EventArgs) Handles
[Link]
End Sub
End Class
DOCUMENT IDENTIFICATION
School of Computing
Universiti Utara Malaysia
REPORT NAME
MATRIC NO.
COURSE
Perceptron
xxxx
STN 2054
PAGE
?/??