There seems to be a wealth of information and tools available for the implementation of standard multivariate or univariate kernel density estimation. However, the discrete geographic data I am currently working with is especially sparse and tends to cluster around areas of high population density.
That is to say, I have a number of points (longitude and latitude) on a map, and I would like to estimate a probability density given the points, but I need to somehow normalize for population density. From looking around, it seems as though the proper method for this type of problem would be to implement some sort of nearest-neighbor adaptive bandwidth for the kernel estimation. Yet, it seems as though the stats.gaussian_kde does not support adaptive bandwidth. Is anyone aware of how I might be able to implement this myself, or if there are any packages available for adaptive bandwidth KDE's?
Kernal Density Estimation function, and is normalized to one (and so ĝ(x) is also normalized to 1). The parameter h is called the “bandwidth”, and scales the width of the kernel. Essentially this just means placing a smooth function at the. location of each data point and then summing the result.
Kernel Density Estimation (KDE) It is estimated simply by adding the kernel values (K) from all Xj. With reference to the above table, KDE for whole data set is obtained by adding all row values. The sum is then normalized by dividing the number of data points, which is six in this example.
The Kernel Density Estimation is a mathematic process of finding an estimate probability density function of a random variable. The estimation attempts to infer characteristics of a population, based on a finite data set.
Kernel Density calculates the density of features in a neighborhood around those features. It can be calculated for both point and line features. Possible uses include finding density of houses, crime reports or density of roads or utility lines influencing a town or wildlife habitat.
I came across this question searching for variable/adaptive kernel density estimation packages in Python. I realize the OP has probably long moved on, but here's what I've found anyway:
This package implements adaptive kernel density estimation algorithms for 1-dimensional signals developed by Hideaki Shimazaki. This enables the generation of smoothed histograms that preserve important density features at multiple scales, as opposed to naive single-bandwidth kernel density methods that can either over or under smooth density estimates.
The kernel bandwith is choosen locally to account for variations in the density of the data. Areas with large density gets smaller kernels and vice versa. This smoothes the tails and gets high resolution in high statistics regions.
This uses the awesome pybind11 package which makes creating C++ bindings super convenient. Only the evaluation is written in a small C++ snippet to speed it up, the rest is a pure python implementation.
This last one does not have an adaptive method, but includes an algorithm that is well suited for multimodal distributions.
This Python 3.5+ package implements various kernel density estimators (KDE). Three algorithms are implemented through the same API: NaiveKDE, TreeKDE and FFTKDE. The class FFTKDE outperforms other popular implementations, see the comparison page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With