Assignment 1
Assignment 1
1
5. Given below is your dataset. You are using KNN regression with K=3. What is the prediction
for a new input value (3, 2)?
X1 X2 Y
2 5 3.5
5 5 5
3 3 3
6 3 4.5
2 2 2
4 1 2.5
Use Euclidean distance measure for finding closest points.
(a) 2
(b) 3
(c) 3.5
(d) 2.5
Sol. (d)
Plot looks like this:
2
7. Find the mean of squared error for the given predictions:
Y f(x)
1 2
2 3
4 5
8 9
16 15
32 31
Hint: Find the squared error for each prediction and take the mean of that.
(a) 1
(b) 2
(c) 1.5
(d) 0
Sol. (a)
(Y − f (x))2
P
M ean squared error =
6
(−1)2 + (−1)2 + (−1)2 + (−1)2 + 12 + 12
=
6
6
=
6
=1
(a) 1
(b) 0
(c) 1.5
(d) 0.5
Sol. (d)
3
L(Y, f (x))
M ean 0 − 1 error =
6
0+1+1+0+1+0
=
6
3
=
6
= 0.5
Sol. (a)
Refer to lecture.
10. Which of the following are true about bias and variance? (multiple options may be correct)
(a) Complex models tend to have high bias.
(b) Complex models tend to have low bias.
(c) Complex models tend to have low variance.
(d) Complex models tend to have high variance.
Sol. (b), (d)
Refer to lecture.