SVM & KNN Flashcards
What is SVM?
Support vector machine
Explain SVM
it works best on smaller and complex datasets
can be used for both regression and classification tasks
here we try to find the best hyperplane that best separates the two classes
how does SVM find the best hyperplane?
SVM does this by finding the maximum margin between the hyperplanes that means the maximum distance between the two classes
what are types of SVM
linear and non linear
what is linear SVM
when the data is perfectly linearly separable.
that means that the data points can be classified into 2 classes using a single straight line
what is non linear SVM
When the data is not linearly separable then we can use Non-Linear SVM, which means when the data points cannot be separated into 2 classes by using a straight line (if 2D) then we use some advanced techniques like kernel tricks to classify them.
what are support vectors
these are the points that are closest to the hyperplane.
what is margin
it is the distance between the hyperplane and the observations closest to the hyperplane (support vectors).
which is considered a good margin
In SVM large margin is considered a good margin.
what is KNN
K - nearest neighbour
explain KNN
it is a popular machine learning algo used for classification and regression tasks
it relies on the fact that similar data points tend to have similar values
what are aspects of KNN
ease of interpreting output
calculation time
predictive power
give an example of KNN
red circle, green square and blue start example
explain the KNN working
1 - select the number K of the neighbours
2 - calculate the Euclidean distance of K number of neighbours
3 - take the K nearest neighbors as per the calculated Euclidean distance.
4 - Among these k neighbors, count the number of the data points in each category.
5 - Assign the new data points to that category for which the number of the neighbor is maximum.
what is Euclidean distance
distance measure to calculate the distance between test samples and trained data values.