Module Expr Str Print NameLoad Import alias identifier Import alias identifier ImportFrom alias alias Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore SubscriptLoad NameLoad ExtSlice Index CompareNotEq NameLoad Num Slice Num Assign NameStore SubscriptLoad NameLoad Index CompareNotEq NameLoad Num Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Num Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore Call AttributeLoad SubscriptLoad NameLoad Index NameLoad attr AttributeLoad NameLoad attr Assign NameStore SubscriptLoad NameLoad Slice BinOpMult Num NameLoad Assign NameStore SubscriptLoad NameLoad Slice BinOpMult Num NameLoad Assign NameStore SubscriptLoad NameLoad Slice BinOpMult Num NameLoad Assign NameStore SubscriptLoad NameLoad Slice BinOpMult Num NameLoad For TupleStore NameStore NameStore Call NameLoad TupleLoad Str Str Str body Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad keyword Num Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad ExtSlice Slice Index Num SubscriptLoad NameLoad ExtSlice Slice Index Num keyword NameLoad keyword Num keyword AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad ExtSlice Slice Index Num SubscriptLoad NameLoad ExtSlice Slice Index Num keyword Num keyword Str keyword Num Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad SubscriptLoad NameLoad ExtSlice Slice Index Num attr Assign NameStore Call AttributeLoad SubscriptLoad NameLoad ExtSlice Slice Index Num attr Assign NameStore Call AttributeLoad SubscriptLoad NameLoad ExtSlice Slice Index Num attr Assign NameStore Call AttributeLoad SubscriptLoad NameLoad ExtSlice Slice Index Num attr Assign TupleStore NameStore NameStore SubscriptLoad AttributeLoad NameLoad attr ExtSlice Slice NameLoad NameLoad Num Slice NameLoad NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index TupleLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad NameLoad CompareGt NameLoad Num keyword AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad keyword ListLoad Str Str Str keyword ListLoad Str Str Str keyword ListLoad Num Num Num Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr
N/A N/A 
================================
SVM Exercise
================================

A tutorial exercise for using different SVM kernels.

This exercise is used in the :ref:`using_kernels_tut` part of the
:ref:`supervised_learning_tut` section of the :ref:`stat_learn_tut_index`.
 N/A __doc__ N/A numpy np N/A matplotlib.pyplot plt sklearn datasets svm N/A iris N/A N/A datasets load_iris N/A X N/A iris data N/A y N/A iris target N/A X N/A X N/A N/A N/A y 0 N/A 2 N/A y N/A y N/A N/A y 0 N/A n_sample N/A len X N/A N/A N/A N/A np random seed 0 N/A order N/A N/A N/A np random permutation n_sample N/A X N/A X N/A order N/A y N/A N/A N/A y N/A order astype N/A np float N/A X_train N/A X N/A N/A 0.9 n_sample N/A y_train N/A y N/A N/A 0.9 n_sample N/A X_test N/A X N/A N/A 0.9 n_sample N/A y_test N/A y N/A N/A 0.9 n_sample N/A N/A fig_num kernel N/A enumerate N/A linear rbf poly N/A N/A clf N/A N/A svm SVC kernel kernel gamma 10 N/A N/A N/A clf fit X_train y_train N/A N/A N/A plt figure fig_num N/A N/A N/A plt clf N/A N/A N/A plt scatter N/A X N/A N/A N/A 0 N/A X N/A N/A N/A 1 c y zorder 10 cmap N/A N/A plt cm Paired N/A N/A N/A plt scatter N/A X_test N/A N/A N/A 0 N/A X_test N/A N/A N/A 1 s 80 facecolors none zorder 10 N/A N/A N/A plt axis tight N/A x_min N/A N/A N/A X N/A N/A N/A 0 min N/A x_max N/A N/A N/A X N/A N/A N/A 0 max N/A y_min N/A N/A N/A X N/A N/A N/A 1 min N/A y_max N/A N/A N/A X N/A N/A N/A 1 max N/A N/A XX YY N/A N/A np mgrid N/A N/A x_min x_max 200j N/A y_min y_max 200j N/A Z N/A N/A clf decision_function N/A N/A np c_ N/A N/A N/A N/A XX ravel N/A N/A YY ravel N/A Z N/A N/A Z reshape N/A XX shape N/A N/A N/A plt pcolormesh XX YY N/A Z 0 cmap N/A N/A plt cm Paired N/A N/A N/A plt contour XX YY Z colors N/A k k k linestyles N/A -- - -- levels N/A -0.5 0 0.5 N/A N/A N/A plt title kernel N/A N/A N/A plt show