particles.distributions.MvNormal¶
-
class
particles.distributions.
MvNormal
(loc=0.0, scale=1.0, cov=None)[source]¶ Multivariate Normal distribution.
Parameters: - loc (ndarray) – location parameter (see below)
- scale (ndarray) – scale parameter (see below)
- cov ((d, d) ndarray) – covariance matrix (see below)
Note
The parametrisation used here is slightly unusual. In short, the following line:
x = dists.MvNormal(loc=m, scale=s, cov=Sigma).rvs(size=30)
is equivalent to:
x = m + s * dists.MvNormal(cov=Sigma).rvs(size=30)
The idea is that they are many cases when we may want to pass varying means and scales (but a fixed correlation matrix).
dx (dimension of vectors x) is determined by matrix cov; for rvs, size must be (N, ), otherwise an error is raised.
Notes: * if du<dx, fill the remaining dimensions by location
(i.e. scale should be =0.)- cov does not need to be a correlation matrix; more generally
> mvnorm(loc=x, scale=s, cor=C) correspond to N(m,diag(s)*C*diag(s))
In addition, note that x and s may be (N, d) vectors; i.e for each n=1…N we have a different mean, and a different scale.
-
__init__
(loc=0.0, scale=1.0, cov=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
([loc, scale, cov])Initialize self. linear_transform
(z)logpdf
(x)pdf
(x)posterior
(x[, Sigma])Posterior for model: X1, …, Xn ~ N(theta, Sigma). ppf
(u)Note: if dim(u) < self.dim, the remaining columns are filled with 0 Useful in case the distribution is partly degenerate rvs
([size])shape
(size)Attributes
dim
int([x]) -> integer int(x, base=10) -> integer dtype