<s> """<STR_LIT>""" <EOL> print ( __doc__ ) <EOL> import numpy as np <EOL> import matplotlib . pyplot as plt <EOL> from sklearn import datasets , svm <EOL> iris = datasets . load_iris ( ) <EOL> X = iris . data <EOL> y = iris . target <EOL> X = X [ y != <NUM_LIT:0> , : <NUM_LIT:2> ] <EOL> y = y [ y != <NUM_LIT:0> ] <EOL> n_sample = len ( X ) <EOL> np . random . seed ( <NUM_LIT:0> ) <EOL> order = np . random . permutation ( n_sample ) <EOL> X = X [ order ] <EOL> y = y [ order ] . astype ( np . float ) <EOL> X_train = X [ : <NUM_LIT> * n_sample ] <EOL> y_train = y [ : <NUM_LIT> * n_sample ] <EOL> X_test = X [ <NUM_LIT> * n_sample : ] <EOL> y_test = y [ <NUM_LIT> * n_sample : ] <EOL> for fig_num , kernel in enumerate ( ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) ) : <EOL> clf = svm . SVC ( kernel = kernel , gamma = <NUM_LIT:10> ) <EOL> clf . fit ( X_train , y_train ) <EOL> plt . figure ( fig_num ) <EOL> plt . clf ( ) <EOL> plt . scatter ( X [ : , <NUM_LIT:0> ] , X [ : , <NUM_LIT:1> ] , c = y , zorder = <NUM_LIT:10> , cmap = plt . cm . Paired ) <EOL> plt . scatter ( X_test [ : , <NUM_LIT:0> ] , X_test [ : , <NUM_LIT:1> ] , s = <NUM_LIT> , facecolors = '<STR_LIT:none>' , zorder = <NUM_LIT:10> ) <EOL> plt . axis ( '<STR_LIT>' ) <EOL> x_min = X [ : , <NUM_LIT:0> ] . min ( ) <EOL> x_max = X [ : , <NUM_LIT:0> ] . max ( ) <EOL> y_min = X [ : , <NUM_LIT:1> ] . min ( ) <EOL> y_max = X [ : , <NUM_LIT:1> ] . max ( ) <EOL> XX , YY = np . mgrid [ x_min : x_max : <NUM_LIT> , y_min : y_max : <NUM_LIT> ] <EOL> Z = clf . decision_function ( np . c_ [ XX . ravel ( ) , YY . ravel ( ) ] ) <EOL> Z = Z . reshape ( XX . shape ) <EOL> plt . pcolormesh ( XX , YY , Z > <NUM_LIT:0> , cmap = plt . cm . Paired ) <EOL> plt . contour ( XX , YY , Z , colors = [ '<STR_LIT:k>' , '<STR_LIT:k>' , '<STR_LIT:k>' ] , linestyles = [ '<STR_LIT>' , '<STR_LIT:->' , '<STR_LIT>' ] , <EOL> levels = [ - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> ] ) <EOL> plt . title ( kernel ) <EOL> plt . show ( ) </s>
