SVC parameters
selects the type of hyperplane used to separate the data. Using ‘linear’ will use a linear hyperplane (a line in the case of 2D data). ‘rbf’ and ‘poly’ uses a non-linear hyper-plane.
kernels = [‘linear’, ‘rbf’, ‘poly’]
for kernel in kernels:
svc = svm.SVC(kernel=kernels).fit(X, y)
plotSVC(‘kernel=’ + str(kernel))
gamma is a parameter for nonlinear hyperplanes. The higher the gamma value it tries to exactly fit the training data set
gammas = [0.1, 1, 10, 100]
for gamma in gammas:
svc = svm.SVC(kernel=’rbf’, gamma=gamma).fit(X, y)
plotSVC(‘gamma=’ + str(gamma))
C is the penalty parameter of the error term. It controls the trade off between smooth decision boundary and classifying the training points correctly.
cs = [0.1, 1, 10, 100, 1000]
for c in cs:
svc = svm.SVC(kernel=’rbf’, C=c).fit(X, y)
plotSVC(‘C=’ + str(c))
degree is a parameter used when kernel is set to ‘poly’. It’s basically the degree of the polynomial used to find the hyperplane to split the data.
degrees = [0, 1, 2, 3, 4, 5, 6]
for degree in degrees:
svc = svm.SVC(kernel=’poly’, degree=degree).fit(X, y)
plotSVC(‘degree=’ + str(degree))