Support vector machines (SVMs)

In [1]:
import addutils.toc ; addutils.toc.js(ipy_notebook=True)
In [2]:
import numpy as np
import pandas as pd
from addutils import css_notebook

1 Support Vector Machines

Support vector machines (SVMs) are a set of supervised learning methods used for classification, regression and outliers detection.

A SVM constructs a hyper-plane or set of hyper-planes in a high or infinite dimensional space with the largest distance to the nearest training data points of any class (functional margin). In general, the larger the margin the lower the generalization error of the classifier.

The advantages of support vector machines include:

  • Effective in high dimensional spaces.
  • Effective in cases where n Features > n Samples.
  • Memory efficient
  • Versatile: different Kernel functions can be specified for the decision function

The disadvantages of support vector machines are:

  • Low performances when n Features >> n Samples.
  • Do not directly provide probability estimates


2 SVM for Classification

SVC and NuSVC are similar methods, but accept slightly different sets of parameters and have different mathematical formulations (see section Mathematical formulation). LinearSVC is another implementation of Support Vector Classification for the case of a linear kernel.

In [3]:
%matplotlib inline
import matplotlib.pyplot as plt
In [4]:
import bokeh.plotting as bk
WARNING:bokeh.resources:Getting CDN URL for local dev version will not produce usable URL