Learn practical skills, build real-world projects, and advance your career

Exercise 7 - Advanced Support Vector Machines

Support vector machines let us predict catergories. In this example we will be looking at practically using SVMs by formatting data correctly, visualising the SVM model and then evaluating the SVM model.

We will be looking at prions - misfolded proteins that are associated with several fatal neurodegenerative diseases (kind of like Daleks, if you have seen Doctor Who). Looking at examples of proteins mass and weight, we will build a predictive model to detect prions in blood samples.

Run the code below to set up the graphing features for this notebook.

# Run this code!
# It sets up the graphing configuration
import warnings
warnings.filterwarnings("ignore")
import matplotlib.pyplot as graph
%matplotlib inline
graph.rcParams['figure.figsize'] = (15,5)
graph.rcParams["font.family"] = 'DejaVu Sans'
graph.rcParams["font.size"] = '12'
graph.rcParams['image.cmap'] = 'rainbow'

Step 1

Lets load up the data first, and save it temporarily as rawData. Our dataset is called "PrionData.csv".

Replace <addPathToData> with 'Data/PrionData.csv' and then Run the code.
import pandas as pd
import numpy as np

###
# REPLACE <addPathToData> BELOW WITH 'Data/PrionData.csv' (INCLUDING THE QUOTES) TO LOAD THE DATA FROM THAT FILE 
###
rawData = pd.read_csv('Data/PrionData.csv')

###

Step 2

Lets take a look at the data.

In the cell below replace the text <printDataHere> with print(rawData.head()) and then Run the code.