# Need help in understanding what is the x1 coordinate if the perceptron is wrong

Hi ,

Greetings!

If the perceptron is wrong we are calculating the weights again and deriving x2. can you please help me in understanding what will be the x1? Also from the below graph could you pls confirm what is the x1 and x2 coordinates of the line which is plotted for classification?

Thanks,

MunishRaghavan

x2 is not derived. (x1, x2) are the coordinates of data already given, along with labels y (see figure below). Given several points and their, labels, perceptron task is to find the values of w(s).

in this particular case, the perceptron classifier function will look like: w1_x1 + w2_*x2+ b

You will initially randomly initialize the w values. Then you substitue the value of x1 and x2 for each data points (one by one) and check if the output label matches y. If there is an error, you update w, using the formula from the algorithm (w+x or w-x). Note w is (w1, w2) and x means (x1, x2)

Once the algorithm converge, you can use the final w’s to plot line (w1x1+w2x2 + b = 0, similar to plotting equation of a line ax + by +c =0)

Hi Sanjay,

My Question is if the say for the below scenario

x belongs to P, where x1=5,x2=10,b=4

where w*x <0, hence w=w+x, Now the new weights are w2=-1.5,w1=8.5,w0=5

then m=5.67,c=-3.33

Plotting this in the line equation x2=mx1+b =>5.67(5)-3.33=25.02;

Now the new line we derived for classification has x2=25.02, what is the x1 value?

Thanks,

MunishRaghavan

(5, 10), its a data point, its fixed.

Note that x1 and x2 in above perceptron line are not same as (x1, x2) of data points marked as Positive or Negative.
Data points will lie on left or right of perceptron(almost always).

Based on your calculation., your perceptron classifier line is: x2 = 5.67x1 - 3.33. You can plot a line using 2 points (join them). And if you have equation of line you can randomly pick x1 to find corresponding x2. You chose x1=5, you got x2=25.02, so you have a point (x1=5, x2=25.02) on the perceptron classifier line. You can find one more point using some other values x1, once you have two sets of (x1, x2), you can plot it on a graph.

In short, (5, 25.02) is point on the perceptron classifier line whereas (5, 10) is a data point. Better use x1 different from 5 (for points on classifier line), it might be less confusing.