Answer to Question #215561 in Python for hassan satti

Question #215561

By using single layer perceptron algorithm classify the following patterns. Where X1 and X2  are inputs Y is the output. Learning rate is 0.5 , output is 1 if weighted sum >=0.5 otherwise 0 and weights w1 =0.2 and w2 = 0.3

1
Expert's answer
2021-07-11T14:38:08-0400
x1 = int(input('Enter X1: '))
x2 =  int(input('Enter X2: '))
w1 = 0.2
w2 = 0.3
lr = 0.5
 
 #calculate weighted sum
weighted_sum  =(w1 * x1)+ (w2 * x2) + lr


# make prediction
print('Weighted sum is :', weighted_sum)
Y = 1 if weighted_sum  >= 0.5 else 0
print ('Output is:', Y )


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS