w3-practice-01--SVM



In [1]:
import pandas as pd

In [5]:
data = pd.read_csv('resources/svm-data.csv', header=None)

In [20]:
target = data[0]
features = data.loc[:, 1:]

In [22]:
from sklearn.svm import SVC

In [24]:
svc = SVC(kernel='linear', C=100000, random_state=241)

In [28]:
svc.fit(features, target)


Out[28]:
SVC(C=100000, cache_size=200, class_weight=None, coef0=0.0,
  decision_function_shape='ovr', degree=3, gamma='auto', kernel='linear',
  max_iter=-1, probability=False, random_state=241, shrinking=True,
  tol=0.001, verbose=False)

In [32]:
svc.support_


Out[32]:
array([3, 4, 9], dtype=int32)

In [42]:
import matplotlib.pyplot as plt
%matplotlib inline

plt.plot(features,linestyle="",marker="o")


Out[42]:
[<matplotlib.lines.Line2D at 0x111633290>,
 <matplotlib.lines.Line2D at 0x111633310>]