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.
- Python PIL | Kernel() method
- Python | Creating a 3D List
- Python | Creating a button in tkinter
- Creating a Proxy Webserver in Python | Set 1
- Creating a Proxy Webserver in Python | Set 2
- Python | Catching and Creating Exceptions
- Python | Creating tensors using different functions in Tensorflow
- Creating child process using fork() in Python
- Linear Regression (Python Implementation)
- Python | Linear Regression using sklearn
- Univariate Linear Regression in Python
- Creating Python Virtual Environment in Windows and Linux
- Python | Creating DataFrame from dict of narray/lists
- Python | Linear search on list or tuples
- Creating a sorted merged list of two unsorted lists in Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.