class_docstr: 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
  
  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].
  
  See Also
  --------
  KDE : kernel density estimation
code: def __init__(self, method="bayesian", n_neighbors=10):
      if method not in ["simple", "bayesian"]:
          raise ValueError("method = %s not recognized" % method)
  
      self.n_neighbors = n_neighbors
      self.method = method
  
file_path: astroML/astroML/density_estimation/density_estimation.py
imports: import numpy
  from scipy import special
  from sklearn.base import BaseEstimator
  from sklearn.neighbors import BallTree
label_desc: Use image node_id 1 to create a new KNeighborsDensity object from inherited base classes: BaseEstimator with example: obj = KNeighborsDensity(method, n_neighbors)