
1.8 k-Nearest Neighbor Density Estimation 21
h=0.1;
pdfx_approx=Parzen_gauss_kernel(X,h,-5,5);
plot(-5:h:5,pdfx_approx,'r');
Exercise 1.7.1
Repeat the experiment in Example 1.7.1 with h = 0.01, N = 1000 and h =0.1, N = 10,000. Comment on the
results. The choice of h for a given N needs careful consideration. Tips related to this choice are provided in
[Theo 09, Sectio n 2.5.6] and the references therein.
Exercise 1.7.2
Generate N = 1000 data points from the following 2-dimensional pdf:
p(x) ≡p(x(1),x(2)) =
1
3
1
2πσ
2
exp
−
x
2
(1) +x
2
(2)
2σ
2
+
2
3
1
2πσ
2
exp
−
x
2
(1) +(x(2) −2)
2
2σ
2
Repeat the experiment in Example 1.7.1.
Exercise 1.7.3
Use the setup for the classificat ...