jpt.distributions.univariate.gaussian

Classes

Gaussian

Extension of dnutils.stats.Gaussian

Module Contents

class jpt.distributions.univariate.gaussian.Gaussian(mean=None, cov=None, data=None, weights=None)

Bases: dnutils.stats.Gaussian

Extension of dnutils.stats.Gaussian

Creates a new Gaussian distribution.

Parameters:
  • mean (float if multivariate else [float] if multivariate) – the mean of the Gaussian

  • cov (float if multivariate else [[float]] if multivariate) – the covariance of the Gaussian

  • data ([[float]]) – if mean and cov are not provided, data may be a data set (matrix) from which the parameters of the distribution are estimated.

  • weights ([float]) – [optional] weights for the data points. The weight do not need to be normalized.

PRECISION = 1e-15
_cl = 'jpt.distributions.univariate.gaussian.Gaussian'
_sum_w = 0
_sum_w_sq = 0
_mean
_cov
data = []
mean()
cov()
var()
property std
deviation(x)

Computes the deviation of x in multiples of the standard deviation.

Parameters:

x

Returns:

__add__(alpha)
__radd__(other)
__iadd__(other)
__mul__(alpha)
__rmul__(other)
__imul__(other)
static wasserstein_distance(d1: Gaussian, d2: Gaussian) float
dim()
sample(n)

Return n samples from this Gaussian distribution.

Parameters:

n – number of samples

Returns:

array of shape (n,) for 1-D or (n, d) for d-dimensional Gaussians

property pdf
cdf(*x)
eval(lower, upper)
copy()
__eq__(other)
linreg()

Compute a 4-tuple <m, b, rss, noise> of a linear regression represented by this Gaussian.

Returns:

m - the slope of the line b - the intercept of the line rss - the residual sum-of-squares error noise - the square of the sample correlation coefficient r^2

References:
update_all(data, weights=None)

Update the distribution with new data points given in data.

estimate(data, weights=None)

Estimate the distribution parameters with subject to the given data points.

update(x, w=1)

update the Gaussian distribution with a new data point x and weight w.

retract(x, w=1)

Retract the data point x with weight w from the Gaussian distribution.

In case the data points are being kept in the distribution, it must actually exist and have the right weight associated. Otherwise, a ValueError will be raised.

sym()
plot(engine=None, **kwargs) Any

Plots the distribution using the given engine.

Parameters:
  • engine – Can be either one of ["plotly", "matplotlib"], or an instance of a rendering engine subclassing DistributionRendering.

  • kwargs – The keyword arguments to pass to the engine as defined in the .plot_gaussian() function of DistributionRendering or its respective subclass defined by engine.

Returns:

the figure object of the plotting engine