[SciPy-User] Weighted KDE

Zachary Pincus zachary.pincus@yale....
Mon Jan 14 10:08:23 CST 2013

> I am facing the same problem as well, but can't figure out how the weighting 
> should be done exactly.
> Has anybody successfully completed the modification of the code to allow a 
> weighted kde? I am attempting to perform kde on a set of imaging data with X, Y, 
> and an additional "temperature" column.
> Performing the kde on only the X,Y axes gives a working heatmap showing the 
> spatial distribution of the data points, but I would also like to use them to 
> see the "temperature" profile (the third axis), much like a geographical heatmap 
> showing temperature or rainfall values over a X-Y map.
> I found another set of code from 
> http://pastebin.com/LNdYCZgw
> which allows weighted kde, but when I tried it out with my data, it took much 
> longer than the normal kde (>1 hour) when the original code took only a about 
> twenty seconds (despite claims that it was faster). 
> Thanks,
> Jackson

Here's a modification of the scipy KDE code that I made to perform weighting, as per the earlier discussion. No guarantees as to correctness, but it seems to be right-ish?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: weighted_kde.py
Type: text/x-python-script
Size: 4770 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/scipy-user/attachments/20130114/539ad9b8/attachment.bin 

More information about the SciPy-User mailing list