ID-5-02 (TO) · Mathematical Foundations of Diffusion Models · W03 demo
A kernel density estimate is a pile of little Gaussians, one per data point. Everything hinges on how wide you make them. Too narrow and you are drawing the sample; too wide and you are drawing nothing at all.
The data below is drawn from a mixture of three normal distributions. Forget that for a moment and look only at the estimate: put a Gaussian of width h on top of every observation, divide by n so the total area is one, and add them up. That sum is the kernel density estimate
p̂h(x) = (1/nh) ∑i φ((x − xi)/h)
Individual kernels, and their sum
Now the truth is drawn too, in grey, so you can see what is being estimated. The three components sit at different places with different widths and weights. Sweep h across its range and watch the estimate fail in two opposite ways.
Estimate against the truth
Because we know the truth here, we can score every bandwidth. Below is the integrated squared error ∫(p̂h − p)²dx as a function of h, computed on the current sample. The curve is U-shaped: variance falls and bias rises, and the minimum is the compromise.
Error against bandwidth
And that is in one dimension. The exponent is n−4/(p+4) in p dimensions. At p = 10 matching this accuracy takes roughly 400,000 samples; at p = 100 it takes more samples than there are atoms within reach. The U-curve does not disappear in high dimension — it just flattens out at a level of error you cannot afford.