From c73143748c4a80a5d83fe3495554da6952cc3914 Mon Sep 17 00:00:00 2001 From: Andreas Mueller Date: Tue, 1 Aug 2017 15:17:28 -0400 Subject: [PATCH 1/2] change data, don't regularize, call plt.show --- examples/svm/plot_separating_hyperplane.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/svm/plot_separating_hyperplane.py b/examples/svm/plot_separating_hyperplane.py index fafadb2d381d0..0cff9de2a8ee5 100644 --- a/examples/svm/plot_separating_hyperplane.py +++ b/examples/svm/plot_separating_hyperplane.py @@ -16,10 +16,10 @@ # we create 40 separable points -X, y = make_blobs(n_samples=40, centers=2, random_state=12, cluster_std=0.35) +X, y = make_blobs(n_samples=40, centers=2, random_state=3) -# fit the model -clf = svm.SVC(kernel='linear') +# fit the model, don't regularize for illustration purposes +clf = svm.SVC(kernel='linear', C=1000) clf.fit(X, y) plt.scatter(X[:, 0], X[:, 1], c=y, s=30, cmap=plt.cm.Paired) @@ -42,3 +42,4 @@ # plot support vectors ax.scatter(clf.support_vectors_[:, 0], clf.support_vectors_[:, 1], s=100, linewidth=1, facecolors='none') +plt.show() From f981e68d27b974bb68219c2ee1cf939180a9728a Mon Sep 17 00:00:00 2001 From: Andreas Mueller Date: Fri, 4 Aug 2017 13:30:18 -0400 Subject: [PATCH 2/2] Update plot_separating_hyperplane.py random_state=6 is the aesthetics consensus --- examples/svm/plot_separating_hyperplane.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/svm/plot_separating_hyperplane.py b/examples/svm/plot_separating_hyperplane.py index 0cff9de2a8ee5..9fdbcc785ed2b 100644 --- a/examples/svm/plot_separating_hyperplane.py +++ b/examples/svm/plot_separating_hyperplane.py @@ -16,7 +16,7 @@ # we create 40 separable points -X, y = make_blobs(n_samples=40, centers=2, random_state=3) +X, y = make_blobs(n_samples=40, centers=2, random_state=6) # fit the model, don't regularize for illustration purposes clf = svm.SVC(kernel='linear', C=1000)