Tuesday, May 21, 2013

Matlab code and demo for kernel density estimation


I've made it a habit to release the source code publicly every time somebody asks me for help with a publicly available algorithm. Having my source code in public actually also showed to improve its readability, and it helps me find it back (because, let's face it, everybody knows it is easier to find a file on Google than on your own computer).

So today I am releasing some Matlab code to perform Parzen's kernel density estimation of one-dimensional data. It's included in the KMBOX toolbox now, and you can download a standalone version with a demo from here: https://sourceforge.net/projects/kmbox/files/packs/


The image shows the output of the included demo.

2 comments:

memming said...

What's the difference compared to MATLAB's ksdensity? I guess you won't need the statistics toolbox just for KDE. :P

Steven said...

It's shorter (40 lines vs. 320 lines) and it's free! Apart from that it's pretty much the same.