I was watching Andrew Ng's machine learning lecture on SVM. There is one line that puzzles me.

$$x^{(i)} - \gamma^{(i)} \frac{w}{||w||}$$

I dont understand how can the line above give the x-coordinate of point B on the decision boundary. Please can someone explain the linear algebra of this line of equation.

enter image description here


1 Answer 1


This equation does not give you "x coordinate of point B", it gives you point $B$

Lets start from the begining

Your have a point $A=:x^{(i)}$. You take normal $w$, which is a vector perpendicular to the decision boundary, you normalize it $\frac{w}{\left | w \right |}$ and get a unit vector in the perpendicular direction (which is parallel to $AB$). As shown on the image,$w$ is directed towards $A$, so $-\frac{w}{\left | w \right |}$ is a unit vector in the opposite direction. Now, if you multiply $-\frac{w}{\left | w \right |}$ and a distance $\gamma^{(i)}$ you get a vector of length $\gamma^{(i)}$ directed in the opposite direction then $A$ (from $w$). Once you add $x^{(i)}$ and $-\gamma^{(i)}\frac{w}{\left | w \right |}$ you get a point, which is placed in distance $\gamma^{(i)}$ from $A$ towards $w$, which is $A$'s projection on $w$ - labeled with $B$ on the image.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .