chaospy.GaussianMixture

class chaospy.GaussianMixture(means, covariances, weights=None, rotation=None)[source]

Gaussian Mixture Model.

A Gaussian mixture model is a probabilistic model that assumes all the data points are generated from a mixture of a finite number of Gaussian distributions with unknown parameters. One can think of mixture models as generalizing K-means clustering to incorporate information about the covariance structure of the data as well as the centers of the latent Gaussians.

Attributes:
means:

Sequence of means.

covariances:

Sequence of covariance matrices.

weights:

How much each sample is weighted. Either a scalar when the samples are equally weighted, or a vector with the same length as the number of mixed models.

Examples:
>>> means = ([0, 1], [1, 0])
>>> covariances = ([[1, 0], [0, 1]], [[1, 0.5], [0.5, 1]])
>>> distribution = GaussianMixture(means, covariances)
>>> uloc = [[0, 0, 1, 1], [0, 1, 0, 1]]
>>> distribution.pdf(uloc).round(4)
array([0.0954, 0.092 , 0.1212, 0.0954])
>>> distribution.fwd(uloc).round(4)
array([[0.3293, 0.3293, 0.6707, 0.6707],
       [0.3699, 0.6731, 0.3711, 0.734 ]])
>>> distribution.inv(uloc).round(4)
array([[-8.9681, -8.9681,  8.0521,  8.0521],
       [-9.862 , 10.1977, -9.5929, 10.2982]])
>>> distribution.mom([(0, 1, 1), (1, 0, 1)]).round(4)
array([0.5 , 0.5 , 0.25])
__init__(means, covariances, weights=None, rotation=None)[source]
Args:
means (numpy.ndarray):

Sequence of mean values. With shape (n_components, n_dim).

covariances (numpy.ndarray):

Sequence of covariance matrices. With shape (n_components, n_dim, n_dim).

weights (Optional[numpy.ndarray]):

Weights of the samples. This must have the shape (n_components,). If omitted, each sample is assumed to be equally weighted.

Methods

pdf(x_data[, decompose, allow_approx, step_size])

Probability density function.

cdf(x_data)

Cumulative distribution function.

fwd(x_data)

Forward Rosenblatt transformation.

inv(q_data[, max_iterations, tollerance])

Inverse Rosenblatt transformation.

sample([size, rule, antithetic, ...])

Create pseudo-random generated samples.

mom(K[, allow_approx])

Raw statistical moments.

ttr(kloc)

Three terms relation's coefficient generator.

Attributes

interpret_as_integer

Flag indicating that return value from the methods sample, and inv should be interpreted as integers instead of floating point.

lower

Lower bound for the distribution.

stochastic_dependent

True if distribution contains stochastically dependent components.

upper

Upper bound for the distribution.