Support Vector Machine Classification
# import SVC
from sklearn.svm import SVC
# model SVC for linear model
svm = SVC(kernel='linear', C=1.0, random_state=0)
# model SVC for non-linear model = Radial Basis Function kernel (RBF kernel)
svm = SVC(kernel='rbf', random_state=0, gamma=0.10, C=10.0)
# increase the gamma (cut-off parameter),
#increase the influence or reach of the training samples,
# which leads to a softer decision boundary but may cause over-fitting
# learn the model
svm.fit(X_train_std, y_train)
# plot
plot_decision_regions(X_combined_std,
y_combined, classifier=svm,
test_idx=range(105,150))
plt.xlabel('petal length [standardized]')
plt.ylabel('petal width [standardized]')
plt.legend(loc='upper left')
plt.show()