0
$\begingroup$

Suppose I have a toy dataset like following

Age   height    label
20    5         young
40    6         old
10    4         young
50    6         old
45    7         old

Depending on the toy dataset I tried to draw a graph

enter image description here

The dataset is a linearly separable dataset. Therefore, the purple, red, and yellow lines all are able to differentiate the two classes. I am thinking about the support vector machine concept. If there are two features support vector machine draw a line to separate two classes. I went through various videos and tutorials. Everyone try to busy explain if there is a line how could I determine that the points are in the positive side or in the negative sides. They also use the equation $$W^TX$$ to determine which side the point should be. However, some videos draw the separation line through origin of the coordinate, some draw lines just below of above the origin.

I would like to know which line I need to consider as the separator of two classes.

One idea:

I draw a line randomly. If the line pass through the origin the equation of the line will be y=mx+c, where say, c =0, m=-1. Afterward, we take each point and find out which side it lies depending on $$W^TX$$

enter image description here

Based on the above idea if I draw a line pass through the origin(pink line), all points lie on one side of the line. So, how could I classify the data into two classes?

Thank you.

$\endgroup$
2
  • $\begingroup$ I am not 100% sure I understand what you are asking for, but if you want to plot your model, this is a way to do it in python: scikit-learn.org/stable/auto_examples/svm/… $\endgroup$ Oct 8, 2022 at 1:55
  • $\begingroup$ My question is which line I need to consider when try to separate two class? $\endgroup$
    – Encipher
    Oct 8, 2022 at 1:57

1 Answer 1

1
$\begingroup$

Your pink line clearly does not work because it does not separate two classes. You need a line that goes between the classes such as your other three lines.

I will draw similar lines here.

enter image description here

Even though each of these lines separates the classes these lines are not good because they are too close to the data points. They work for the training data but if you add new data, the lines may classify them incorrectly. So, we need a line that is farther from the data.

Let's draw a margin between each line and the closest data.

enter image description here

The larger the margin, the better the line. SVM finds the line with the largest margin. enter image description here

Here, the margin is shown by the dashed lines. The data points through which it goes, are called support vectors.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.