sort out plot_iris vs plot_svm_iris

This commit is contained in:
Jaques Grobler 2013-10-14 18:28:07 +02:00 committed by Andreas Mueller
parent 9b4799282e
commit ea7ad29123
2 changed files with 13 additions and 4 deletions

View File

@ -439,9 +439,10 @@ the separating line (less regularization).
|svm_margin_unreg| |svm_margin_reg|
============================= ==============================
.. image:: ../../auto_examples/svm/images/plot_svm_iris_1.png
:target: ../../auto_examples/svm/plot_svm_iris.html
:scale: 83
.. topic:: Example:
- :ref:`example_svm_plot_iris.py`
SVMs can be used in regression --:class:`SVR` (Support Vector Regression)--, or in
classification --:class:`SVC` (Support Vector Classification).

View File

@ -46,15 +46,23 @@ for i, clf in enumerate((svc, rbf_svc, poly_svc, lin_svc)):
# Plot the decision boundary. For that, we will assign a color to each
# point in the mesh [x_min, m_max]x[y_min, y_max].
pl.subplot(2, 2, i + 1)
pl.subplots_adjust(wspace=0.4, hspace=0.4)
Z = clf.predict(np.c_[xx.ravel(), yy.ravel()])
# Put the result into a color plot
Z = Z.reshape(xx.shape)
pl.contourf(xx, yy, Z, cmap=pl.cm.Paired)
pl.axis('off')
# Plot also the training points
pl.scatter(X[:, 0], X[:, 1], c=Y, cmap=pl.cm.Paired)
pl.xlabel('Sepal length')
pl.ylabel('Sepal width')
pl.xlim(xx.min(), xx.max())
pl.ylim(yy.min(), yy.max())
pl.xticks(())
pl.yticks(())
pl.title(titles[i])