Perceptron Learning Rule
• Apply Perceptron Rule Learning to get the final W values, Test the system
after training
data= [Link] ( [ 1, 1, 1, 1],
[ 1, 0, 1, -1],
[ 0, 1, 1, -1],
[ 0, 0, 1, -1])
Perceptron Learning Rule
w1=w2=b=0; a=1; 𝜃=0.2
For epoch from 1 to 10
data= [Link] ( [ 1, 1, 1, 1],
For i from 0 to nSample
[ 1, 0, 1, -1],
𝑌𝑖𝑛 = 𝑏 + σ 𝑋𝑖 × 𝑤𝑖
[ 0, 1, 1, -1],
if 𝑌𝑖𝑛 > 𝜃 Then y=1
[ 0, 0, 1, -1])
if −𝜃 ≤ 𝑌𝑖𝑛 ≤ 𝜃 Then y=0
if 𝑌𝑖𝑛 < −𝜃 Then y=-1
HW. Write a Python program
to implement Adaline NN.
if y ≠ 𝑡𝑖 Then
(And gate).
𝑤𝑖 = 𝑤𝑖 + 𝑎 × 𝑡𝑖 × 𝑥𝑖
𝑏𝑖 = 𝑏𝑖 + 𝑎 × 𝑡𝑖
Print w1, w2, b
Result
Acutal_Y estimated_Y
1 1
-1 -2
-1 -1
-1 -4