COMP4702/COMP7703 - Machine Learning Homework W10 - Kernel Machines
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
COMP4702/COMP7703 - Machine Learning
Homework W10 - Kernel Machines
Questions
1. (3 marks) Suppose that the following are a set of points in two classes: class 1 :
![]()
![]()
![]()
class 2 :
![]()
![]()
![]()
Plot them and find the optimal separating line. What are the support vectors, and what is the margin1? Note: this question can be done “by hand”/using “pen and paper”.
2. (1 mark) Using the data and your answer from the previous question, calculate the (Euclidean) distance between the optimal separating line (i.e. the discriminant) and the point (5 .23 7.14)T .
3. (2 marks) Lodhi et al. [1] describe the string subsequence kernel and illustrate its calculation with an example (p.422-423). If this example was expanded to include the word “rat”, how many dimensions would the feature space have?
4. (4 marks) From the lecture material, we know that there is an equivalance between the kernel function and the basis functions in support vector machines:
k(x, x′) = ϕ(x).ϕ(x′)
for two data points x and x′ . One interesting example of a kernel function is the Arc-cosine kernel:
kac(x, x′) = (sinθ + (π − θ)cosθ)
which is known to have an equivalence
n
kapprox(x, x′) = n X max(0, wi .x)max(0, wi .x′) ≈ kac ,
with the approximation becoming exact as n → ∞. Here, wi is a weight vector of dimensionality equal to the dimensionality of x, with each entry in wi drawn independently from N(0, 1).
Examine this approximation by writing a program to compute and plot the value of kac and kapprox as a function of θ .
Hints:
• Use the dataset supplied (hw8.csv) as your input data. Use (e.g) the first 500 columns of the dataset as examples of x, the other half as examples of x′ . The angles between these vectors (θ) have been calculated for you in the final column. Note also that in this dataset, ||x|| = ||x′ || = 1 for all data points.
• Plot kac as a curve, and overlay kapprox as points that should roughly follow the curve.
• State the value of n you have used to create your plot.
5. (2 marks) Consider kapprox from the previous question. What machine learning model (recently covered in the course!) does this equation describe? Be specific about the model (e.g. its structure and any functions used within the model).
2022-05-14