Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. def Perceptron(input1, input2, output) :
  2.    outputP = input1*weights[0]+input2*weights[1]+bias*weights[2]
  3.    if outputP > 0 : #activation function (here Heaviside)
  4.       outputP = 1
  5.    else :
  6.       outputP = 0
  7.    error = output – outputP
  8.    weights[0] += error * input1 * lr
  9.    weights[1] += error * input2 * lr
  10.    weights[2] += error * bias * lr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement