Back to questions
JuniorTheoryCommon
What does this program print?
import numpy as np
X = np.array([[0, 0], [1, 1], [2, 1], [3, 2], [1, 3], [4, 3]])
y = np.array([-1, -1, -1, -1, 1, 1])
w = np.array([1, 1])
b = -3
margins = y * (X @ w + b)
print(int((margins < 1).sum()), int((margins < 0).sum()))2 1
- Expecting
1 1: the point[2, 1]lies on the line itself, itsmarginsvalue is0, which is below1, so it violates the margin too. - Expecting
4 1: the points[1, 1]and[1, 3]give exactly1, which puts them on the edge of the band, andmargins < 1does not count them.
- Which of these six points are support vectors of this line?
- How wide is the band of this line, and how would doubling
wandbchange it?