image info

Implementation of SVM from scratch and comparison with KNN With K-Fold Cross Validation (Synthetic Data)

Sanchayan Bhunia (4849650)

KNN Classifier

SVM Classifier

Data Generation

Classification Error Calculation KNN

Classification Error Calculation SVM

KNN Train-Test Error Analysis

SVM Train-Test Error Analysis

K-Fold Cross Validation for KNN

K-Fold Cross Validation for SVM

Generating the data synthetically

Calling the model to get an overview for a fixed Regularization Parameter

Let's check the trainig and validation error for Order of the Regularization Parameters

Let's run a K-Fold Cross-validation on SVM

Train-Test Analysis of the dataset using KNN

K-Fold Cross Validation for KNN on the same dataset

For this data-set the error is same (0.0333) for both SVM and KNN with theri best regularization parameter. But SVM takes a lot of time to compute w.r.t. KNN. The power of SVM comes with data with high dimension and low in number.



Link to the project on Github

https://github.com/sanchayan721/SupportVectorMachineVsKNN