jax.scipy.stats.gaussian_kde#

class jax.scipy.stats.gaussian_kde(dataset, bw_method=None, weights=None)[source]#

Representation of a kernel-density estimate using Gaussian kernels.

LAX-backend implementation of scipy.stats._kde.gaussian_kde().

Original docstring below.

Kernel density estimation is a way to estimate the probability density function (PDF) of a random variable in a non-parametric way. gaussian_kde works for both uni-variate and multi-variate data. It includes automatic bandwidth determination. The estimation works best for a unimodal distribution; bimodal or multi-modal distributions tend to be oversmoothed.

Parameters
  • dataset (array_like) – Datapoints to estimate from. In case of univariate data this is a 1-D array, otherwise a 2-D array with shape (# of dims, # of data).

  • bw_method (str, scalar or callable, optional) – The method used to calculate the estimator bandwidth. This can be ‘scott’, ‘silverman’, a scalar constant or a callable. If a scalar, this will be used directly as kde.factor. If a callable, it should take a gaussian_kde instance as only parameter and return a scalar. If None (default), ‘scott’ is used. See Notes for more details.

  • weights (array_like, optional) – weights of datapoints. This must be the same shape as dataset. If None (default), the samples are assumed to be equally weighted

References

1

D.W. Scott, “Multivariate Density Estimation: Theory, Practice, and Visualization”, John Wiley & Sons, New York, Chicester, 1992.

2

B.W. Silverman, “Density Estimation for Statistics and Data Analysis”, Vol. 26, Monographs on Statistics and Applied Probability, Chapman and Hall, London, 1986.

3

B.A. Turlach, “Bandwidth Selection in Kernel Density Estimation: A Review”, CORE and Institut de Statistique, Vol. 19, pp. 1-33, 1993.

4

D.M. Bashtannyk and R.J. Hyndman, “Bandwidth selection for kernel conditional density estimation”, Computational Statistics & Data Analysis, Vol. 36, pp. 279-298, 2001.

5

Gray P. G., 1969, Journal of the Royal Statistical Society. Series A (General), 132, 272

__init__(dataset, bw_method=None, weights=None)[source]#

Methods

__init__(dataset[, bw_method, weights])

evaluate(points)

Evaluate the estimated pdf on a set of points.

integrate_box(low_bounds, high_bounds[, maxpts])

This method is not implemented in the JAX interface.

integrate_box_1d(low, high)

Computes the integral of a 1D pdf between two bounds.

integrate_gaussian(mean, cov)

Multiply estimated density by a multivariate Gaussian and integrate

integrate_kde(other)

Computes the integral of the product of this kernel density estimate

logpdf(x)

Evaluate the log of the estimated pdf on a provided set of points.

pdf(x)

Evaluate the estimated pdf on a provided set of points.

resample(key[, shape])

Randomly sample a dataset from the estimated pdf

set_bandwidth([bw_method])

This method is not implemented in the JAX interface.

tree_flatten()

tree_unflatten(aux_data, children)

Attributes

d

n

neff

dataset

weights

covariance

inv_cov