kde_scikitlearn#
- agabpylib.densityestimation.kde.kde_scikitlearn(data, N=100, lims=None, evalOnData=False, kde_bandwidth=1.0, **kwargs)#
Provide a kernel density estimate for a set of data points (d_i).
Make use of the sklearn.neighbours.KernelDensity class.
- Parameters:
data (float array) – 1D array of values of d_i
lims (tuple) – Limits on data to use (dmin, dmax)
N (int) – Number of KDE samples in d (regular grid between dmin and dmax)
evalOndata (boolean) – If true return the log(density) evaluated on the data (instead of the regular grid)
kde_bandwidth (float) – Bandwith for density estimator
**kwargs (dict) – Extra arguments for KernelDensity class initializer
- Returns:
Dsamples, log_dens – Dsamples, log_dens: The log(density) evaluated on the regular grid Dsamples (both shape (N,)) If evalOnData is True return only log_dens evaluated for the data points (shape (data.size,)).
- Return type:
float array