jpt.distributions.univariate.gaussian
Classes
Extension of |
Module Contents
- class jpt.distributions.univariate.gaussian.Gaussian(mean=None, cov=None, data=None, weights=None)
Bases:
dnutils.stats.GaussianExtension of
dnutils.stats.GaussianCreates 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
meanandcovare not provided,datamay 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
xin multiples of the standard deviation.- Parameters:
x –
- Returns:
- __add__(alpha)
- __radd__(other)
- __iadd__(other)
- __mul__(alpha)
- __rmul__(other)
- __imul__(other)
- dim()
- sample(n)
Return
nsamples 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 lineb- the intercept of the linerss- the residual sum-of-squares errornoise- the square of the sample correlation coefficientr^2
- 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
xand weightw.
- 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 subclassingDistributionRendering.kwargs – The keyword arguments to pass to the engine as defined in the
.plot_gaussian()function ofDistributionRenderingor its respective subclass defined byengine.
- Returns:
the figure object of the plotting engine