Skip to content
Snippets Groups Projects
Commit 1a5f412d authored by Fabian Pedregosa's avatar Fabian Pedregosa
Browse files

Revert "Update svm examples affected by latest API changes."

This reverts commit 8606d6f0.
parent ca5c6ac1
No related branches found
No related tags found
No related merge requests found
"""
===========================================
SVM: Maximum margin separating hyperplane
SVM: Maximum separating margin hyperplane
===========================================
Plot the maximum margin separating hyperplane within a two-class
separable dataset using a Support Vector Machines classifier with
linear kernel.
"""
import numpy as np
......@@ -29,9 +26,9 @@ yy = a*xx - (clf.intercept_[0])/w[1]
# plot the parallels to the separating hyperplane that pass through the
# support vectors
b = clf.support_vectors_[0]
b = clf.support_[0]
yy_down = a*xx + (b[1] - a*b[0])
b = clf.support_vectors_[-1]
b = clf.support_[-1]
yy_up = a*xx + (b[1] - a*b[0])
# plot the line, the points, and the nearest vectors to the plane
......@@ -40,7 +37,7 @@ pl.plot(xx, yy, 'k-')
pl.plot(xx, yy_down, 'k--')
pl.plot(xx, yy_up, 'k--')
pl.scatter(X[:,0], X[:,1], c=Y)
pl.scatter(clf.support_vectors_[:,0], clf.support_vectors_[:,1], c='white')
pl.scatter(clf.support_[:,0], clf.support_[:,1], marker='+')
pl.axis('tight')
pl.show()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment