KDE Interface

KDE objects store the final result of the estimation. This usually consists of an array of densities mapped to the selected grid. They also store the samples used for the estimation.

There are currently two concrete KDE types, one for CPU and one for CUDA devices. However, the interface is otherwise the same, so that it is possible to use the same code for both devices. It is also possible to create custom KDE objects that conform to the interface.

ParallelKDE.KDEs.AbstractKDEType
AbstractKDE{N,T,S}

Supertype for kernel density estimation (KDEs) with N dimensions, T type for density values, and S type for data points.

ParallelKDE.KDEs.KDEType
KDE{N,T<:Real,S<:Real}

CPU object for kernel density estimation (KDE) with N dimensions, T type for density values, and S type for data points.

ParallelKDE.KDEs.CuKDEType
CuKDE{N,T<:Real,S<:Real}

CUDA object for kernel density estimation (KDE) with N dimensions, T type for density values, and

The following is a set of functions that extract information from KDE objects.

ParallelKDE.Devices.get_deviceFunction
get_device(device::Any)

Obtain the device object for a given device type.

If the method is called with an unsupported type, it returns a DeviceNotSpecified object.

get_device(grid::AbstractGrid)

Identify the device type of the grid, returning IsCPU for CPU grids and IsCUDA for CUDA grids.

get_device(kde::AbstractKDE)

Identify the device type used by the kernel density estimation (KDE) object.

ParallelKDE.KDEs.get_dataFunction
get_data(kde::AbstractKDE)

Return a view of the data stored in the kernel density estimation (KDE) object.

ParallelKDE.KDEs.get_densityMethod
get_density(kde::AbstractKDE)

Return the density values stored in the kernel density estimation (KDE) object.

ParallelKDE.KDEs.get_nsamplesFunction
get_nsamples(kde::AbstractKDE)

Return the number of samples in the kernel density estimation (KDE) object.

It is possible to create a KDE object from the samples to be used for the estimation with

ParallelKDE.KDEs.initialize_kdeFunction
initialize_kde(data, dims...; device=:cpu)

Create a kernel density estimation (KDE) object with the given data and dimensions.

Setting the density currently stored in the KDE object to a new set of values is done with

ParallelKDE.KDEs.set_density!Function
set_density!(kde::AbstractKDE, density::AbstractArray)

Set the density values in the kernel density estimation (KDE) object to the provided array.

whereas resetting the density to NaN can be done with

Creating sets of sample indices of bootstrap samples from the KDE object is also possible with

ParallelKDE.KDEs.bootstrap_indicesFunction
bootstrap_indices(kde::AbstractKDE, n_bootstraps)

Obtain a matrix of bootstrap indices for the kernel density estimation (KDE) object.

The matrix has n_samples rows and n_bootstraps columns, where each column contains indices sampled with replacement from the range 1:n_samples.