Support Vector Machines

Motivation: how to split the data?

based on slides by Dr. Jiayin Wang

Motivation: how to split the data?

Linear regression: y = β₀ + β₁x

Motivation: how to split the data?

Motivation: how to split the data?

Motivation of SVM: Use tools from optimization to find the best lines (or hyper planes or curves) that divide the two datasets.

Motivation: how to split the data?

Motivation: how to split the data?

Motivation: how to split the data?

Motivation: how to split the data?

Support Vector Machines (VMS)

Support Vector Machines (VMS)

  • Optimization: maximize the margin
  • Constrains: support vectors need to be away from the margin
  • Useful when complex data that cannot be separated by a simple line
  • More computationally expensive

The data

We will be working with Mental Health Care data.

Download the clean data by biological sex.

Replicate the plot below:

Fitting a SVM model

Here’s the import statement:

from sklearn.svm import SVC

Calling it:

model = SVC()