Four observations are x=1.5, 2, 4, 7. What is the estimated density at x=3 using (a) a box kernel of width 2h=4, that is K(u)=12 for ∣u∣≤1 with h=2, and (b) a Gaussian kernel with h=1?

Supervised learning, Parzen windows and kernel density estimation
Level L2 Elementary. Length Medium. Nature Mat Mathematical.

What's being asked

Whether you can apply f^(x)=1nh∑K ⁣(x−xih) with two different kernels.

Key idea

f^(x)=1nh∑iK ⁣(x−xih); for a box it is (points in window)/(n×width).

Steps

  1. Here n=4 and x=3. Distances ∣3−xi∣ are 1.5, 1, 1, 4.
  2. (a) Box with h=2: a point counts if ∣3−xi∣/2≤1, that is ∣3−xi∣≤2. The points 1.5,2,4 count and 7 does not. Each contributes K=12.
  3. f^(3)=14×2(3×12)=1.58=0.1875. Check: 3 points in a window of width 4, out of 4 points, gives 34×4=0.1875.
  4. (b) Gaussian with h=1: K(u)=12πe−u2/2. The values at u=1.5,1,1,4 are 0.1295, 0.2420, 0.2420, 0.0001. Their sum is 0.6136.
  5. f^(3)=14×1×0.6136≈0.153.
  6. The two answers are close, but the Gaussian gives every point some weight, while the box ignores the point at 7 completely.

Common mistakes

How long your answer should be

Half a page; 4 minutes.

Last checked on 4 December 2026.

Read this

Previous in Supervised learning: A multinomial naive Bayes spam filter uses the vocabulary {win,cash,meeting}. Training: spam documents "win win cash" and "cash cash"; ham documents "meeting win" and "meeting meeting cash". Using Laplace (add-one) smoothing, classify the new document "win meeting meeting". Why is the smoothing needed?
Next in Supervised learning: For the four data points (1,2),(2,3),(3,5),(4,4), set up and solve the normal equations for the line y=β0+β1x. What are the residual sum of squares and the unbiased noise-variance estimate σ^2?