diff --git a/examples/plot_svm.py b/examples/plot_svm.py index f4f2decd8b4e6057995c8b2563ed27ac8a89afb3..d2556eb50119cfa364d52318795225d4d3b28c3b 100644 --- a/examples/plot_svm.py +++ b/examples/plot_svm.py @@ -10,9 +10,9 @@ from scikits.learn import svm, datasets iris = datasets.load('iris') X = iris.data[:, :2] # we only take the first two features. We could # avoid this ugly slicing by using a two-dim dataset -Y = iris.label +Y = iris.target -h=.05 # step size in the mesh +h=.02 # step size in the mesh # we create an instance of SVM and fit out data. We do not scale our # data since we want to plot the support vectors @@ -28,10 +28,11 @@ Z = clf.predict(np.c_[xx.ravel(), yy.ravel()]) # Put the result into a color plot Z = Z.reshape(xx.shape) +pl.set_cmap(pl.cm.Paired) pl.pcolormesh(xx, yy, Z) # Plot also the training points -pl.scatter(X[:,0], X[:,1], c=iris.label) +pl.scatter(X[:,0], X[:,1], c=Y) # and the support vectors pl.scatter(clf.support_[:,0], clf.support_[:, 1], marker='+') pl.title('3-Class classification using Support Vector Machine. \n' + \