11.2.2.2. astroML.density_estimation.KDE¶
- class astroML.density_estimation.KDE(metric='gaussian', h=None, **kwargs)¶
Kernel Density Estimate
Note
Deprecated in astroML 0.2 Scikit-learn version 0.14 added a KernelDensity estimator class which has much better performance than this class. The KDE class will be removed in astroML version 0.3.
Parameters : metric : string or callable
[‘gaussian’|’tophat’|’exponential’] or one of the options in sklearn.metrics.pairwise_kernels. See pairwise_kernels documentation for more information. For ‘gaussian’ or ‘tophat’, ‘exponential’, and ‘quadratic’, the results will be properly normalized in D dimensions. This may not be the case for other metrics.
h : float (optional)
if metric is ‘gaussian’ or ‘tophat’, h gives the width of the kernel. Otherwise, h is not referenced.
**kwargs : :
other keywords will be passed to the sklearn.metrics.pairwise_kernels function.
See also
-, -, -
Notes
Kernel forms are as follows:
‘gaussian’ : K(x, y) ~ exp( -0.5 (x - y)^2 / h^2 )
- ‘tophat’ : K(x, y) ~ 1 if abs(x - y) < h
~ 0 otherwise
‘exponential’ : K(x, y) ~ exp(- abs(x - y) / h)
- ‘quadratic’ : K(x, y) ~ (1 - (x - y)^2) if abs(x) < 1
~ 0 otherwise
All are properly normalized, so that their integral over all space is 1.
Methods
eval(X) Evaluate the kernel density estimation fit(X) Train the kernel density estimator - __init__(metric='gaussian', h=None, **kwargs)¶