1 of 30

Data Mining_Anoop Chaturvedi

1

Swayam Prabha

Course Title

Multivariate Data Mining- Methods and Applications

Lecture 38

SVM for Linearly Non-Separable Cases and SVM Regression

By

Anoop Chaturvedi

Department of Statistics, University of Allahabad

Prayagraj (India)

Slides can be downloaded from https://sites.google.com/view/anoopchaturvedi/swayam-prabha

2 of 30

Example: Iris Dataset⇒ Observations on sepal and petal lengths and width of 150 flowers, 50 each of Iris Sentosa, Iris Versicolor, and Iris Virginica.

Objective ⇒ Classifying Iris Species Using SVM

R packages used to train the model ⇒ GGplot2, tidyverse, e1071, tune

We start with a linear kernel.

Sampling method ⇒ 10-fold cost validation.

Data Mining_Anoop Chaturvedi

2

3 of 30

Data Mining_Anoop Chaturvedi

3

4 of 30

Data Mining_Anoop Chaturvedi

4

Dataset ⇒ 100 train data + 50 test data

Use training set to create SVM model

5 of 30

Data Mining_Anoop Chaturvedi

5

SVM is able to correctly identify 96 of the 100 observations

6 of 30

Best Parameters tunning

Data Mining_Anoop Chaturvedi

6

7 of 30

Data Mining_Anoop Chaturvedi

7

For the test set, best SVM model is able to accurately predict 49/50, i.e., with 98% accuracy.

Using 10-fold CV we achieve a model with 96% accuracy.

8 of 30

Data Mining_Anoop Chaturvedi

8

9 of 30

Linearly Non-separable Case

Some data from one class may infiltrate to region of space belonging to the other class.

Because of such overlaps some of the overlapping points may be misclassified.

Non-separable case occurs if

(i) two classes are nonlinearly separable, or

(ii) no clear separability exists between the two classes.

High noise levels (large variances) of one or both classes may cause overlapping classes.

Data Mining_Anoop Chaturvedi

9

10 of 30

  •  

Data Mining_Anoop Chaturvedi

10

11 of 30

  •  

Data Mining_Anoop Chaturvedi

11

12 of 30

  •  

Data Mining_Anoop Chaturvedi

12

13 of 30

  •  

Data Mining_Anoop Chaturvedi

13

 

14 of 30

  •  

Data Mining_Anoop Chaturvedi

14

15 of 30

  •  

Data Mining_Anoop Chaturvedi

15

16 of 30

  •  

Data Mining_Anoop Chaturvedi

16

17 of 30

  •  

Data Mining_Anoop Chaturvedi

17

18 of 30

  •  

Data Mining_Anoop Chaturvedi

18

19 of 30

  •  

Data Mining_Anoop Chaturvedi

19

20 of 30

  •  

Data Mining_Anoop Chaturvedi

20

21 of 30

 

  •  

Data Mining_Anoop Chaturvedi

21

-c c

 

Huber error measure

22 of 30

  •  

Data Mining_Anoop Chaturvedi

22

23 of 30

  •  

Data Mining_Anoop Chaturvedi

23

24 of 30

  •  

Data Mining_Anoop Chaturvedi

24

25 of 30

  •  

Data Mining_Anoop Chaturvedi

25

26 of 30

Example: Generated data on two variates and classified using kernel SVM.

Data Mining_Anoop Chaturvedi

26

27 of 30

Data Mining_Anoop Chaturvedi

27

28 of 30

Data Mining_Anoop Chaturvedi

28

Parameters tunning

29 of 30

Data Mining_Anoop Chaturvedi

29

From figure we observe that number of training errors is large. Increasing the value of cost reduces the number of training errors. Then, it leads to more irregular decision boundary with a risk of overfitting the data.

30 of 30

Data Mining_Anoop Chaturvedi

30