text: import numpy as np
  from sklearn import datasets
  from sklearn.preprocessing import StandardScaler
  from sklearn.metrics import accuracy_score
  from sklearn.linear_model import LogisticRegression
  from sklearn.linear_model import Perceptron
  from sklearn.svm import SVC
  from sklearn.tree import DecisionTreeClassifier
  from sklearn.ensemble import RandomForestClassifier
  from sklearn.neighbors import KNeighborsClassifier
  # from sklearn.tree import export_graphviz
  from matplotlib.colors import ListedColormap
  import matplotlib.pyplot as plt
  import warnings
  from plot_decision_regions import *
  
  # for sklearn 0.18's alternative syntax
  from distutils.version import LooseVersion as Version
  from sklearn import __version__ as sklearn_version
  if Version(sklearn_version) < '0.18':
      from sklearn.grid_search import train_test_split
  else:
      from sklearn.model_selection import train_test_split
  
  #############################################################################
  iris = datasets.load_iris()
  X = iris.data[:, [2, 3]]
  y = iris.target
  print('Class labels:', np.unique(y))
  
  X_train, X_test, y_train, y_test = train_test_split(
      X, y, test_size=0.3, random_state=0)
  
  sc = StandardScaler()
  sc.fit(X_train)
  X_train_std = sc.transform(X_train)
  X_test_std = sc.transform(X_test)
  
  X_combined_std = np.vstack((X_train_std, X_test_std))
  y_combined = np.hstack((y_train, y_test))
  
  #############################################################################
  svm = SVC(kernel='rbf', random_state=0, gamma=0.2, C=1.0)
  #svm = SVC(kernel='rbf', random_state=0, gamma=100.0, C=1.0)
  svm.fit(X_train_std, y_train)
  
  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.tight_layout()
  # plt.savefig('./figures/support_vector_machine_rbf_iris_1.png', dpi=300)
  plt.show()
  