11.2.2.2. astroML.density_estimation.KNeighborsDensity

class astroML.density_estimation.KNeighborsDensity(method='bayesian', n_neighbors=10)[source]

K-neighbors density estimation

Parameters
methodstring

method to use. Must be one of [‘simple’|’bayesian’] (see below)

n_neighborsint

number of neighbors to use

See also

KDE

kernel density estimation

Notes

The two methods are as follows:

  • simple:

    The density at a point x is estimated by n(x) ~ k / r_k^n

  • bayesian:

    The density at a point x is estimated by n(x) ~ sum_{i=1}^k[1 / r_i^n].

Methods

eval(X)

Evaluate the kernel density estimation

fit(X)

Train the K-neighbors density estimator

__init__(method='bayesian', n_neighbors=10)[source]

Initialize self. See help(type(self)) for accurate signature.