Kernel Density Estimation
An implementation of kernel density estimation with dual-tree algorithms. Given a set of reference points and query points and a kernel function, this can estimate the density function at the location of each query point using trees.
Available Predicates
initAndBuildModel/14
Build the KDE model with the given parameters and then trains it with the given reference data.
%% part of the predicate definition
initAndBuildModel( +float32, +float32, +float32,
+string, +string, +string,
+integer,
+float32, +integer, +float32, +float32,
+pointer(float_array), +integer, +integer).
Parameters
Name | Type | Description | Default |
---|---|---|---|
bandwidth | +float | Bandwidth of the kernel. | 1.0 |
relError | +float | Relative error tolerance for the prediction. | 0.05 |
absError | +float | Absolute error tolerance for the prediction. | 0.0 |
kernelType | +string | Kernel to use for the prediction.(‘gaussian’, ‘epanechnikov’, ‘laplacian’, ‘spherical’, ‘triangular’). | gaussian |
treeType | +string | Tree to use for the prediction.(‘kd-tree’, ‘ball-tree’, ‘cover-tree’, ‘octree’, ‘r-tree’). | kd-tree |
algorithm | +string | Algorithm to use for the prediction.(‘dual-tree’, ‘single-tree’). | dual-tree |
monteCarlo | +integer(bool) | Whether to use Monte Carlo estimations when possible. | (0)false |
mcProb | +float | Probability of the estimation being bounded by relative error when using Monte Carlo estimations. | 0.95 |
initialSampleSize | +integer | 100 | |
mcEntryCoef | +float | Controls how much larger does the amount of node descendants has to be compared to the initial sample size in order to be a candidate for Monte Carlo estimations. | 3.0 |
mcBreakCoef | +float | Controls what fraction of the amount of node’s descendants is the limit for the sample size before it recurses. | 0.4 |
referenceSet | +matrix | Input reference dataset use for KDE. | - |
evaluateWithQuery/5
Perform kernel density estimation on the given query set.
initAndBuildModel/14 has to be called before.
%% part of the predicate definition
evaluateWithQuery( +pointer(float_array), +integer, +integer,
-pointer(float_array), -integer).
Parameters
Name | Type | Description | Default |
---|---|---|---|
querySet | +matrix | Query dataset to KDE on. | - |
estimations | -vector | Vector to store density predictions. | - |
evaluateNoQuery/2
Perform kernel density estimation on the reference set.
If possible, it returns normalized estimations.
initAndBuildModel/14 has to be called before.
%% part of the predicate definition
evaluateNoQuery( -pointer(float_array), -integer).
Parameters
Name | Type | Description | Default |
---|---|---|---|
estimations | -vector | Vector to store density predictions. | - |
Connected Links/Resources
If you want a more detailed explanation, then go to the python documentation. There is most of the time a good explanation on how the methods work and what the parameters do.
added some of the links from the python documentation