DEV Community

Anubhav Shukla
Anubhav Shukla

Posted on

Understanding Perceptron. How does it work, without going into Mathematics

Understanding the Perceptron

The perceptron is like a decision-making algorithm. Imagine you want to know if someone will pass an exam. The perceptron takes information like IQ and study hours, gives each piece a 'weight' based on its importance, adds them up, and decides: 'Yes, they'll pass' or 'No, they won't.' It's like a smart helper that learns from mistakes and gets better at making these yes-or-no decisions over time

Let's see this with the help of a figure

Perception First

The red dot represents the student who failed the exam while the green one represents the one who passed.

Now what perceptron does is draw a line to separate this yes and no

This is what it does:

⭐. First, it will start a line (that will separate pass and fail) from some initial place

Perceptron Image 1

⭐. From here the loop begins.

⭐. Choose a random point

Perceptron Image 2
⭐. It checks if that student is going to fail or pass. It does that by putting the coordinate of that point in the equation of the line.

X * IQ + Y * studyHour.

Now if the solution of the equation becomes positive it will pass otherwise it will fail

Perceptron 3

⭐. Suppose it chooses this point

Perceptron 4

The green point should lie in the positive part of the line (as it represents the pass) while the red one should lie in the negative part of the line.

Since the selected point is at the correct position we don't do anything and choose another point.

⭐.Now we choose this point

Perceptron 5

This point is also in the correct position we don't do anything and choose another point.

⭐.Now we choose this point

Perceptron 6

Now this point lies on the wrong side and also putting the coordinate of this point in our line equation will produce a negative result. So we move our line such that this point lies in the negative part of the figure

Perceptron 7

⭐.After following these steps repeatedly it will finally give a line like this

Perception Final

Now if we have a student with its IQ and study hours we just need to put that information in the equation of the line and it will tell us if the student is going to pass or fail

Top comments (0)