gmdistribution
statistics: gmdistribution
Create an object of the gmdistribution class which represents a Gaussian mixture model with k components of n-dimensional Gaussians.
Input mu is a k-by-n matrix specifying the n-dimensional mean of each of the k components of the distribution.
Input Sigma is an array that specifies the variances of the distributions, in one of four forms depending on its dimension.
If p is specified, it is a vector of length k specifying the proportion of each component. If it is omitted or empty, each component has an equal proportion.
Input extra is used by fitgmdist to indicate the parameters of the fitting process.
See also: fitgmdist
Source Code: gmdistribution
The gmdistribution class contains the following properties:
A k-by-d matrix holding the mean of each of the k components, one per row, where d is the number of variables. This property is read-only.
The covariances of the components, in the form they were given in. A full covariance per component is d-by-d-by-k, a diagonal one per component 1-by-d-by-k, a full covariance shared by every component d-by-d, and a shared diagonal one 1-by-d. This property is read-only.
A 1-by-k row vector holding the proportion of each component. The proportions are scaled to sum to 1, and are all equal when none was given. This property is read-only.
The character vector 'gaussian mixture distribution'. This
property is read-only.
A positive integer, the number of rows of mu. This property
is read-only.
A positive integer, the dimension of each component, which is the
number of columns of mu. This property is read-only.
A character vector, 'diagonal' when each covariance was
given as a row of variances and 'full' when it was given as
a matrix. This property is read-only.
A logical scalar, true when a single covariance was given for every component and false when one was given per component. This property is read-only.
A scalar, twice the negative log-likelihood plus twice the number of
estimated parameters. It is empty unless the object came from
fitgmdist. This property is read-only.
A scalar, twice the negative log-likelihood plus the number of
estimated parameters times the log of the number of observations.
It is empty unless the object came from fitgmdist. This
property is read-only.
A logical scalar, true when the fit reached its tolerance within the
iteration limit. It is empty unless the object came from
fitgmdist. This property is read-only.
A scalar, the negative of the log-likelihood of the data under the
fitted mixture. It is empty unless the object came from
fitgmdist. This property is read-only.
A positive integer. It is empty unless the object came from
fitgmdist. This property is read-only.
A nonnegative scalar added to the diagonal of each covariance to
keep it positive definite. It is empty unless the object came from
fitgmdist. This property is read-only.
The gmdistribution class offers the following public methods:
gmdistribution: obj = gmdistribution (mu, Sigma)
gmdistribution: obj = gmdistribution (mu, Sigma, p)
gmdistribution: obj = gmdistribution (mu, Sigma, p, extra)
mu is a k-by-d matrix holding the mean of each of the k components, one per row, where d is the number of variables.
Sigma holds the covariances in one of four forms. A full
covariance per component is d-by-d-by-k and a diagonal one per
component is 1-by-d-by-k, while a single d-by-d matrix or a single
1-by-d row of variances is shared by every component. The form given
sets CovarianceType and SharedCovariance.
p is a vector of k mixing proportions, scaled to sum to 1. A proportion may not be negative and they may not all be zero. When p is omitted or empty the components are equally weighted.
extra carries the results of a fit and is passed by
fitgmdist. It fills AIC, BIC,
Converged, NegativeLogLikelihood,
NumIterations and RegularizationValue, which stay
empty for an object built by hand.
gmdistribution: c = cdf (obj, X)
X is an n-by-d matrix of points at which the distribution is
evaluated, one point per row, where d is the number of variables of
obj. c is an n-by-1 vector holding the value of the
cumulative distribution function at each of them, the components’
cumulative distributions summed with the mixing proportions in
ComponentProportion as weights.
gmdistribution: idx = cluster (obj, X)
gmdistribution: [idx, nlogl] = cluster (obj, X)
gmdistribution: [idx, nlogl, P] = cluster (obj, X)
gmdistribution: [idx, nlogl, P, logpdf] = cluster (obj, X)
gmdistribution: [idx, nlogl, P, logpdf, M] = cluster (obj, X)
X is an n-by-d matrix of observations, one per row, where d is the number of variables of obj. Each is assigned to the component under which it is most probable.
idx is an n-by-1 vector of component indices. nlogl is the negative log-likelihood of X under the mixture. P is an n-by-k matrix of posterior probabilities, one column per component, whose rows sum to one. logpdf is an n-by-1 vector holding the logarithm of the mixture density at each observation. M is an n-by-k matrix of squared Mahalanobis distances from each observation to each component mean.
gmdistribution: D = mahal (obj, X)
X is an n-by-d matrix of observations, one per row, where d is the number of variables of obj. D is an n-by-k matrix holding the squared Mahalanobis distance from each observation to the mean of each of the k components, measured in the covariance of the component it is taken to.
gmdistribution: c = pdf (obj, X)
X is an n-by-d matrix of points at which the density is
evaluated, one point per row, where d is the number of variables of
obj. c is an n-by-1 vector holding the density at each of
them, the components’ densities summed with the mixing proportions in
ComponentProportion as weights.
gmdistribution: c = posterior (obj, X)
X is an n-by-d matrix of observations, one per row, where d is the number of variables of obj. c is an n-by-k matrix whose (i,j) element is the probability that observation i was drawn from component j, so its rows sum to one.
gmdistribution: c = random (obj)
gmdistribution: c = random (obj, n)
n is the number of observations to draw and defaults to 1.
c is an n-by-d matrix holding one observation per row,
where d is the number of variables of obj. Each row is drawn
from a component chosen with probability ComponentProportion.
gmdistribution: obj = fit (X, k)
gmdistribution: obj = fit (X, k, Name, Value)
X is an n-by-d matrix of observations, one per row, and k
is the number of components to fit. Any Name-Value pair
accepted by fitgmdist may follow, which is the function this
method calls and where the options are documented. obj is the
fitted gmdistribution object.