Let’s create a Linear Kernel SVM using the sklearn library of Python and the Iris Dataset that can be found in the dataset library of Python.
Linear Kernel is used when the data is Linearly separable, that is, it can be separated using a single Line. It is one of the most common kernels to be used. It is mostly used when there are a Large number of Features in a particular Data Set. One of the examples where there are a lot of features, is Text Classification, as each alphabet is a new feature. So we mostly use Linear Kernel in Text Classification.
In the above image, there are two set of features “Blue” features and the “Yellow” Features. Since these can be easily separated or in other words, they are linearly separable, so the Linear Kernel can be used here.
Advantages of using Linear Kernel:
1. Training a SVM with a Linear Kernel is Faster than with any other Kernel.
2. When training a SVM with a Linear Kernel, only the optimisation of the C Regularisation parameter is required. On the other hand, when training with other kernels, there is a need to optimise the γ parameter which means that performing a grid search will usually take more time.
- Major Kernel Functions in Support Vector Machine (SVM)
- ML | Non-Linear SVM
- SVM Hyperparameter Tuning using GridSearchCV | ML
- Introduction to Support Vector Machines (SVM)
- Python PIL | Kernel() method
- Creating and updating PowerPoint Presentations in Python using python - pptx
- Linear Regression (Python Implementation)
- Python | Linear search on list or tuples
- Python | Linear Regression using sklearn
- Univariate Linear Regression in Python
- Python | Linear Programming in Pulp
- Solving Linear Regression in Python
- Creating a Proxy Webserver in Python | Set 1
- Creating a Proxy Webserver in Python | Set 2
- Creating a sorted merged list of two unsorted lists in Python
- Python | Creating a 3D List
- Creating Python Virtual Environment in Windows and Linux
- Creating child process using fork() in Python
- Python | Creating tensors using different functions in Tensorflow
- Python | Creating a button in tkinter
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.