File Exchange

image thumbnail

2D Bandwidth Estimator for KDE

version 1.4 (25.3 KB) by

2D kernel density estimator from weighted data.



View License

The submission includes a code for estimating a 2D bandwidth ("getBandwidth.m") matrix for a Gaussian Kernel Density Estimator. The included demonstration code ("demoBWEstimation.m") estimates a bandwidth from a weighted set of data-points and displays the resulting KDE by tabulating it, as well as displaying it as a Gaussian Mixture Model. The bandwidth calculation is a special case of a more general bandwidth estimator [1], which was developed originally for online density estimation.

[1] Kristan et al., Multivariate Online Kernel Density Estimation with Gaussian Kernels, Pattern Recognition, 2011 (url:

Comments and Ratings (2)

bmv, thanks for the error dump. Apparently there was a leftover dependency on the Lightspeed Toolbox. I've updated the submission and it now includes the missing function.


bmv (view profile)

>> demoBWEstimation

Undefined function 'col_sum' for input arguments of type 'double'.
Error in normmixpdf (line 56)
    pl = logConstant - 0.5*col_sum(dx.*dx);
Error in evaluatePointsUnderPdf (line 17)
[ p, model ] = normmixpdf( model, X, minerr ) ;
Error in visualizePdf2d2 (line 51)
p = evaluatePointsUnderPdf(pdf, data) ;
Error in visualizeKDE (line 55)
    outdat = visualizePdf2d2( kde.pdf, boundsIm, [], grans ) ;
Error in demoBWEstimation (line 47)
subplot(2,3,1) ; I_k = visualizeKDE('kde', kde_k, 'tabulated', 1) ;



added the following missing function:

function s = col_sum( a )

s = sum(a,1) ;


Just the description.

MATLAB Release
MATLAB 7.12 (R2011a)

Inspired: Ensemble MCMC sampler

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video