Sir, the below code is from the ‘*Perceptron’ Class’s ‘Fit’ fn.* :

I understand it as below :

If y=1 & y_pred=0 then *add the current wt. to x & increment ‘b’ by 1*

If y=0 & y_pred=1 then *deduct the current wt. from x & decrement ‘b’ by 1*

My doubts wrt the above code Sir :

- Is my understanding correct… Can you please explain the intuition behind it
- In either case since we’re dealing with y ≠ y_pred then shouldn’t the logic be the same for both?
- What’s the intuition behind :
- adding/deducting the current wt. to/from x &
- incrementing/decrementing 1 to ‘b’ value

Sir, can you please explain the intuition behind the code & the concept.

Thank you.