Problem 7
Consider a dataset that consists of two samples (x^{(0)}, 1) and (x^{(1)}, -1), where x^{(0)}, x^{(1)} \in \mathbb{R}^d.
Define a separating hyperplane in the form
\hat{\theta}^{\top}x + b = 0,
where \hat{\theta} \in \mathbb{R}^d is a unit vector, b \in \mathbb{R}, x^{(0)} is in the upper half of this hyperplane and x^{(0)} and x^{(1)} have equal distance to this hyperplane.
Do the following tasks.
Part 7.1
Let x^{(0)} = (-3, 0) and x^{(1)} = (3, 0).
Compute \hat{\theta} and b. Reasoning is not required.
Part 7.2
Let x^{(0)} = (5, 7) and x^{(1)} = (-3, 2).
Compute \hat{\theta} and b. Reasoning is not required.
Part 7.3
This is a coding task. Write a function to compute \hat{\theta} and b.
- In this function, the input is a NumPy array with shape
(2,d). - In the output, \hat{\theta} is a NumPy array with shape
(d,)and b is a NumPy array with shape