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)¶