[SciPy-User] What is the kernel in gaussian_kde?

Simon McGregor londonien@gmail....
Wed Sep 21 10:57:23 CDT 2011


I'm about to try and implement a simple entropy estimator using
scipy.stats.kde. The estimator can be implemented for arbitrary
kernels (though it won't be particularly efficient).

gaussian_kde is all nicely set up to do density estimation,
integration and various other things - but the kernel itself is not

The scipy / numpy matrix operators are still not completely intuitive
for me, so reverse-engineering the kernel from the code is proving a
bit tricky. The online tutorials I have read on Gaussian kde all use
one-dimensional examples, which obscure the meaning of the covariance
matrix in the multi-dimensional case. My linear algebra isn't too
strong, so again my intuitions aren't good here.

If anyone could just spell out what the kernel is, I would be
amazingly grateful.

It looks like it's something like

K(a-b) = exp ( (a-b) . M(a-b) / 2)

...where M is the inverse covariance matrix and . indicates the scalar
product of two vectors. Is this right?

Many thanks,


More information about the SciPy-User mailing list