This documentation is for astroML version 0.2

This page

Links

astroML Mailing List

GitHub Issue Tracker

Videos

Scipy 2012 (15 minute talk)

Scipy 2013 (20 minute talk)

Citing

If you use the software, please consider citing astroML.

11.2.2.3. astroML.density_estimation.KNeighborsDensity

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

K-neighbors density estimation

Parameters :

method : string

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

n_neighbors : int

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)