Skip to content

Commit 4d82658

Browse files
committed
use LinearSVC in plot_linear_svc_regularization
1 parent 1ff45b3 commit 4d82658

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mglearn/plot_linear_svc_regularization.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import matplotlib.pyplot as plt
22
import numpy as np
3-
from sklearn.svm import SVC
3+
from sklearn.svm import LinearSVC
44
from sklearn.datasets import make_blobs
55

66
from .plot_helpers import discrete_scatter
@@ -16,10 +16,10 @@ def plot_linear_svc_regularization():
1616
x_min, x_max = X[:, 0].min() - .5, X[:, 0].max() + .5
1717
y_min, y_max = X[:, 1].min() - .5, X[:, 1].max() + .5
1818

19-
for ax, C in zip(axes, [1e-2, 1, 1e2]):
19+
for ax, C in zip(axes, [1e-2, 10, 1e3]):
2020
discrete_scatter(X[:, 0], X[:, 1], y, ax=ax)
2121

22-
svm = SVC(kernel='linear', C=C, tol=0.00001).fit(X, y)
22+
svm = LinearSVC(C=C, tol=0.00001, dual=False).fit(X, y)
2323
w = svm.coef_[0]
2424
a = -w[0] / w[1]
2525
xx = np.linspace(6, 13)

0 commit comments

Comments
 (0)