# cvxopt_svm

cvxopt_svm, a Python code which solves a support vector machine (SVM) problem by formulating it as a quadratic programming problem to be solved by cvxopt().

We are given m data pairs (x_i,y_i), with each y_i being a "grade" of -1 or +1. We also assume that the data is linearly separable, that is, that at least one straight line can be which splits the data into positive and negative graded items.

An SVM can be thought of as a function f(x)=x'*w+b such that f(x_i) is negative when y_i is -1 and positive when y_i is +1. Moreover, the formula is "optimal" in the sense that the line f(x)=0 optimally separates the two sets of data with the widest possible margin, and for which the closest positive and negative graded data items have f(x) equal to +1 or -1, respectively.

The SVM problem can be described as solving:

```        minimize    w'w
subject to yi ( x'wi+b) >= 1 for 1 <= i <= m
```

The cvxopt package includes a quadratic programming option to find x:

```       minimize   1/2 x' P x + q' x
subject to G x <= h
A x = b
```

This program demonstrates how to read our problem data and arrange them in a format that allows us to call the cvxopt solver solvers.qp().

### Licensing:

The computer code and data files described and made available on this web page are distributed under the MIT license

### Languages:

cvxopt_svm is available in a Python version.

### Source Code:

• cvxopt_svm.png, a plot of the data and the separating SVM line.
• jet_engine.txt, the data file, containing 56 values of index, rpm, vib, grade.

Last revised on 01 April 2019.