Creating a predictive model using Support Vector Machines

Support Vector Machines (SVMs) are a group of supervised learning methods that can be applied to classification or regression.

For this recipe, we are going to use the Heart dataset from An Introduction to Statistical Learning with Applications in R.

How to do it…

  1. First, import the Python libraries that you need:
    import pandas as pd
    import numpy as np
    import matplotlib as plt
    import matplotlib.pyplot as plt
    %matplotlib inline
  2. Next, define a variable for the heart data file, import the data, and view the top five rows:
    data_file = '/Users/robertdempsey/Dropbox/private/Python Business Intelligence Cookbook/Data/ISL/Heart.csv' heart = pd.read_csv(data_file, sep=',', header=0, index_col=0, parse_dates=True, ...

Get Python Business Intelligence Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.