kalepy.kernels¶
Kernal basis functions for KDE calculations, used by kalepy.kde.KDE class.
Contents:
Kernel
: class performing the numerical/mathematical functions of a KDE using a particular kernel-function.Distribution
: base class for kernel-function functionalityGaussian(Distribution)
: class for Gaussian kernel functionsBox_Asym(Distribution)
: class for box (top-hat) kernel functionsParabola(Distribution)
: class for parabolic (Epanechnikov) kernel functionsget_distribution_class
: returns the appropriate Distribution subclass matching the given string specification.get_all_distribution_classes
: returns a list of active Distribution subclasses (used for testing).
-
class
kalepy.kernels.
Box_Asym
¶ Bases:
kalepy.kernels.Distribution
-
classmethod
cdf
(xx)¶
-
classmethod
inside
(points)¶
-
classmethod
-
class
kalepy.kernels.
Distribution
¶ Bases:
object
Distribution positional arguments (xx or yy) must be shaped as (D, N) for ‘D’ dimensions and ‘N’ data-points.
-
property
FINITE
¶
-
property
SYMMETRIC
¶
-
__init__
()¶ Initialize self. See help(type(self)) for accurate signature.
-
cdf
(xx)¶
-
property
cdf_grid
¶
-
classmethod
evaluate
(xx)¶
-
classmethod
grid
(edges, **kwargs)¶
-
classmethod
inside
(points)¶
-
classmethod
name
()¶
-
ppf
(cd)¶ Percentile Point Function - the inverse of the cumulative distribution function.
NOTE: for symmetric kernels, this (effectively) uses points only with cdf in [0.0, 0.5], which produces better numerical results (unclear why).
-
sample
(size, ndim=None, squeeze=None)¶
-
property
-
class
kalepy.kernels.
Gaussian
¶ Bases:
kalepy.kernels.Distribution
-
cdf
(yy)¶
-
classmethod
inside
(points)¶
-
classmethod
norm
(ndim=1)¶
-
-
class
kalepy.kernels.
Kernel
(distribution=None, bandwidth=None, covariance=None, helper=False, chunk=100000.0)¶ Bases:
object
-
property
FINITE
¶
-
__init__
(distribution=None, bandwidth=None, covariance=None, helper=False, chunk=100000.0)¶ Initialize self. See help(type(self)) for accurate signature.
-
property
bandwidth
¶
-
property
covariance
¶
-
density
(points, data, weights=None, reflect=None, params=None)¶ Calculate the Density Function using this Kernel.
- Parameters
points ((D, N), 2darray of float,) – N points at which to evaluate the density function over D parameters (dimensions). Locations must be specified for each dimension of the data, or for each of target params dimensions of the data.
-
property
distribution
¶
-
property
matrix
¶
-
property
matrix_inv
¶
-
property
norm
¶
-
resample
(data, weights=None, size=None, keep=None, reflect=None, squeeze=True)¶
-
property
-
class
kalepy.kernels.
Parabola
¶ Bases:
kalepy.kernels.Distribution
-
classmethod
cdf
(xx)¶
-
classmethod
-
kalepy.kernels.
get_all_distribution_classes
()¶
-
kalepy.kernels.
get_distribution_class
(arg=None)¶