Back to questions
JuniorTheoryCommon
What does this program print?
import numpy as np
from sklearn.svm import SVC
X = np.array([[0, 0], [2, 0], [0, 2], [2, 2], [3, 3], [4, 2]])
y = np.array([0, 0, 0, 1, 1, 1])
hard = SVC(kernel="linear", C=1000).fit(X, y)
soft = SVC(kernel="linear", C=0.01).fit(X, y)
print(len(hard.support_), len(soft.support_))3 6
- Expecting
6 3: a largeCmakes violations expensive and narrows the band, so few points touch it; a smallCwidens the band until every point is inside it. - Expecting
3 3: support vectors are not only the points on the edge of the band; every point inside it or past it is one too, and a smallClets in more.
- How does the width of the band change between
hardandsoft? - Which value of
Cwould you try first on noisy data, and why?