Perceptron
Perceptron
• Consider threshold =0
• Epochs = 3
Epoch 1: Error Calculation
• Weights: w0=1, w1=1, w2= 1
• Ynet=x0*w0+x1*w1+x2*w2
• Input (0,0):
– Ynet=1*1+0*1+0*1=1
– Ynet>=0: neuron fires
– Output=1
– Error=Actual-Output=0-1=-1 (Error non zero, change weights)
– W0=1+(-1)*1=0
– W1=1+(-1)*0=1
– W2=1+(-1)*0=1
• Updated weights: w0=0, w1=1, w2=1
Epoch 1: Error Calculation
• weights: w0=0, w1=1, w2=1
• Ynet=x0*w0+x1*w1+x2*w2
• Input (0,1):
– Ynet=1*0+0*1+1*1=1
– Ynet>=0: neuron fires
– Output=1
– Error=Actual-Output=0-1=-1 (Error non zero, change weights)
– W0=0+(-1)*1=-1
– W1=1+(-1)*0=1
– W2=1+(-1)*1=0
• Updated weights: w0=-1, w1=1, w2=0
Epoch 1: Error Calculation
• weights: w0=-1, w1=1, w2=0
• Ynet=x0*w0+x1*w1+x2*w2
• Input (1,0):
– Ynet=1*-1+1*1+0*0=0
– Ynet>=0: neuron fires
– Output=1
– Error=Actual-Output=0-1=-1 (Error non zero, change weights)
– W0=-1+(-1)*1=-2
– W1=1+(-1)*1=0
– W2=0+(-1)*0=0
• Updated weights: w0=-2, w1=0, w2=0
Epoch 1: Error Calculation
• weights: w0=-2, w1=0, w2=0
• Ynet=x0*w0+x1*w1+x2*w2
• Input (1,1):
– Ynet=1*-2+1*0+1*0=-2
– Ynet>=0: neuron does not fire
– Output=0
– Error=Actual-Output=1-0=1 (Error non zero, change weights)
– W0=-2+(1)*1=-1
– W1=0+(1)*1=1
– W2=0+(1)*1=1
• Updated weights: w0=-1, w1=1, w2=1