Skip to content
ml-recall

#linear-svm

1 question from Support Vector Machines

Timed test

1 question · 1 min · score and explanations at the end

Take a test
Q 1 / 1Score 0 / 0

Question 1: True or false

mediumAI-checkedSupport Vector Machines
import numpy as np
from sklearn.svm import SVC

X = np.array([[0, 0], [1, 1], [0, 2], [3, 3], [4, 2], [5, 5]], dtype=float)
y = np.array([0, 0, 0, 1, 1, 1])

svm = SVC(kernel="linear", C=1000).fit(X, y)
sv = svm.support_                        # indices of the support vectors
svm2 = SVC(kernel="linear", C=1000).fit(X[sv], y[sv])

print(np.allclose(svm.coef_, svm2.coef_),
      np.allclose(svm.intercept_, svm2.intercept_))

True or false: the last line prints True True, i.e. retraining on the support vectors alone gives the same decision boundary.

Choose one option