Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def Perceptron(input1, input2, output) :
- outputP = input1*weights[0]+input2*weights[1]+bias*weights[2]
- if outputP > 0 : #activation function (here Heaviside)
- outputP = 1
- else :
- outputP = 0
- error = output – outputP
- weights[0] += error * input1 * lr
- weights[1] += error * input2 * lr
- weights[2] += error * bias * lr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement