License : Creative Commons Attribution 4.0 International (CC BY-NC-SA 4.0)
Copyright : Hervé Frezza-Buet, CentraleSupelec
Last modified : February 15, 2024 11:13
Link to the source : index.md

Table of contents

SVM lecture materials

Demo with the gaml library

Here are some demos that you can easily reproduce. Play with the parameters, as done below. To do so, you have to install first the libsvm

mylogin@mymachine:~$ sudo apt install libsvm3 libsvm-dev

as well as gaml and its libsvm wrapper. Then, download and uncompress this archive.

Classification

C-SVC, linear, big C

#define NB_SAMPLES    1000
#define SPACE_FILTER  filter_blobs
#define ORACLE        oracle_split

#define MISCLASSIFICATION_RATIO 0

  params.svm_type    = C_SVC;
  params.kernel_type = LINEAR; 
  params.C           = 1;
  params.eps         = 1e-8; // numerical tolerence

C-SVC, linear, small C

  params.C           = .001;

nu-SVC, linear

  params.svm_type    = NU_SVC;
  params.nu          = .2;

nu-SVC, polynomial, big checker

#define NB_SAMPLES     1000
#define SPACE_FILTER   filter_true
#define ORACLE         oracle_checker
#define CHECKER_PERIOD .1 
#define MISCLASSIFICATION_RATIO 0

  params.svm_type    = NU_SVC;
  params.nu          = .1; 
  params.kernel_type = POLY;
  params.gamma       = 1;  
  params.degree      = 3;
  params.coef0       = 1;

nu-SVC, Gaussian, big checker

  params.svm_type    = NU_SVC;
  params.nu          = .1; 
  params.kernel_type = RBF;
  params.gamma       = 1; 

nu-SVC, Gaussian, small checker

#define CHECKER_PERIOD 1 

nu-SVC, Gaussian, small checker, few samples

#define NB_SAMPLES     100

nu-SVC, Gaussian, small checker, few samples, small \(\sigma\)

params.gamma       = 10; 

One-class

1-class, Potato

#define NB_SAMPLES    100
#define SPACE_FILTER  filter_blobs

  params.svm_type    = ONE_CLASS;
  params.kernel_type = RBF;
  params.gamma       = .05; 
  params.nu          = .05;
  params.eps         = 1e-8; // numerical tolerence

1-class, Banana

#define SPACE_FILTER  filter_banana

  params.gamma       = .1; 

1D regression

1D \(\epsilon\)-SVR, linear, line

#define NB_SAMPLES      100
#define ORACLE          oracle_line
#define NOISE_AMPLITUDE 0

  params.svm_type    = EPSILON_SVR;
  params.kernel_type = LINEAR; 
  params.p           = .2;  // epsilon
  params.C           =  1;
  params.eps         = 1e-8; // numerical tolerence

1D \(\epsilon\)-SVR, linear, sinus

#define ORACLE          oracle_sinus
#define NOISE_AMPLITUDE 0.2

1D \(\epsilon\)-SVR, polynomial, sinus

  params.kernel_type = POLY; 
  params.gamma       = 1;  
  params.degree      = 3;
  params.coef0       = 1;

1D \(\epsilon\)-SVR, Gaussian, sinus

  params.kernel_type = RBF; 
  params.gamma       = 1;  

1D \(\epsilon\)-SVR, Gaussian, sinus, few samples

#define NB_SAMPLES     10

  params.kernel_type = RBF; 
  params.gamma       = 10; 

2D \(\epsilon\)-SVR, Gaussian

#define NB_SAMPLES      150
#define ORACLE          oracle_wave
#define NOISE_AMPLITUDE 0
  params.svm_type    = EPSILON_SVR;
  params.kernel_type = RBF; 
  params.gamma       = .75;  
  params.p           = .2;  // epsilon
  params.C           =  1;
  params.eps         = 1e-8; // numerical tolerence

2D \(\nu\)-SVR, Gaussian

  params.svm_type    = NU_SVR;
  params.nu          = .5; 

2D \(\nu\)-SVR, Gaussian, noise

#define NOISE_AMPLITUDE 0.1

C,\(\sigma\) classification movies

When C varies

When \(\sigma\) varies

Hervé Frezza-Buet,