A Gaussian kernel density estimate with bandwidth h is built from the three 1-D points 1, 2 and 4. (a) Write p^(x) and compute p^(2) for h=1. (b) What does p^(2) become for h=0.2, and what does the change in h do to the estimate in general?

Unsupervised learning, Density estimation
Level L2 Elementary. Length Medium. Nature Th+Mat Both.

What's being asked

Whether you can evaluate a kernel density estimate and explain the bias–variance role of the bandwidth.

Key idea

p^(x)=1nh∑iK ⁣(x−xih) with K(u)=12πe−u2/2: a small Gaussian bump of width h on every data point, averaged.

Steps

  1. Each point adds a bump, and p^ is the average of the n=3 bumps: p^(x)=13h∑i12πe−(x−xi)2/2h2.
  2. At x=2 with h=1 the distances are 1,0,2. The exponentials are e−0.5=0.6065, e0=1 and e−2=0.1353, summing to 1.7419.
  3. p^(2)=13⋅12π⋅1.7419=0.3989×1.74193≈0.232.
  4. With h=0.2 the distances 1 and 2 are 5 and 10 bandwidths away, so those bumps contribute almost nothing (e−12.5 and e−50). Only the point 2 counts: p^(2)≈13⋅0.2⋅0.3989≈0.665.
  5. A small h gives a spiky estimate with low bias but high variance (it has one peak per data point). A large h oversmooths and merges modes, giving high bias but low variance.
  6. In practice h is chosen by cross-validated log-likelihood or a rule of thumb such as Silverman's rule.

Common mistakes

How long your answer should be

Half a page; 4 minutes.

Last checked on 4 December 2026.

Read this

Previous in Unsupervised learning: In matrix factorisation for recommendation, a rating r=4 is modelled as r^=p⊤q with user vector p=(1,0.5) and item vector q=(2,1). With squared loss plus L2 penalty 12λ(∥p∥2+∥q∥2), learning rate η=0.1 and λ=0.1, perform one stochastic gradient step on this rating. What are the new p, q and prediction?
Next in Unsupervised learning: A one-class SVM with an RBF kernel is trained on n=200 normal points with ν=0.05. (a) What does ν guarantee about the number of training points outside the learned boundary and the number of support vectors? (b) What happens if you set ν=0.5 instead, and why would ν be a poor choice for contaminated data if set too small?