Package smile.stat.distribution
Class MultivariateMixture
java.lang.Object
smile.stat.distribution.MultivariateMixture
- All Implemented Interfaces:
Serializable
,MultivariateDistribution
- Direct Known Subclasses:
MultivariateExponentialFamilyMixture
The finite mixture of multivariate distributions.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A component in the mixture distribution is defined by a distribution and its weight in the mixture. -
Field Summary
Modifier and TypeFieldDescriptionfinal MultivariateMixture.Component[]
The components of finite mixture model. -
Constructor Summary
ConstructorDescriptionMultivariateMixture
(MultivariateMixture.Component... components) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiondouble
bic
(double[][] data) Returns the BIC score.double
cdf
(double[] x) Cumulative distribution function.cov()
The covariance matrix of distribution.double
entropy()
Shannon entropy.int
length()
The number of parameters of the distribution.double
logp
(double[] x) The density at x in log scale, which may prevents the underflow problem.int
map
(double[] x) Returns the index of component with maximum a posteriori probability.double[]
mean()
The mean vector of distribution.double
p
(double[] x) The probability density function for continuous distribution or probability mass function for discrete distribution at x.double[]
posteriori
(double[] x) Returns the posteriori probabilities.int
size()
Returns the number of components in the mixture.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface smile.stat.distribution.MultivariateDistribution
likelihood, logLikelihood
-
Field Details
-
components
The components of finite mixture model.
-
-
Constructor Details
-
MultivariateMixture
Constructor.- Parameters:
components
- a list of multivariate distributions.
-
-
Method Details
-
posteriori
public double[] posteriori(double[] x) Returns the posteriori probabilities.- Parameters:
x
- a real vector.- Returns:
- the posteriori probabilities.
-
map
public int map(double[] x) Returns the index of component with maximum a posteriori probability.- Parameters:
x
- a real vector.- Returns:
- the index of component with maximum a posteriori probability.
-
mean
public double[] mean()Description copied from interface:MultivariateDistribution
The mean vector of distribution.- Specified by:
mean
in interfaceMultivariateDistribution
- Returns:
- the mean vector.
-
cov
Description copied from interface:MultivariateDistribution
The covariance matrix of distribution.- Specified by:
cov
in interfaceMultivariateDistribution
- Returns:
- the covariance matrix.
-
entropy
public double entropy()Shannon entropy. Not supported.- Specified by:
entropy
in interfaceMultivariateDistribution
- Returns:
- Shannon entropy
-
p
public double p(double[] x) Description copied from interface:MultivariateDistribution
The probability density function for continuous distribution or probability mass function for discrete distribution at x.- Specified by:
p
in interfaceMultivariateDistribution
- Parameters:
x
- a real vector.- Returns:
- the desnity.
-
logp
public double logp(double[] x) Description copied from interface:MultivariateDistribution
The density at x in log scale, which may prevents the underflow problem.- Specified by:
logp
in interfaceMultivariateDistribution
- Parameters:
x
- a real vector.- Returns:
- the log density.
-
cdf
public double cdf(double[] x) Description copied from interface:MultivariateDistribution
Cumulative distribution function. That is the probability to the left of x.- Specified by:
cdf
in interfaceMultivariateDistribution
- Parameters:
x
- a real vector.- Returns:
- the probability.
-
length
public int length()Description copied from interface:MultivariateDistribution
The number of parameters of the distribution. The "length" is in the sense of the minimum description length principle.- Specified by:
length
in interfaceMultivariateDistribution
- Returns:
- the number of parameters of the distribution.
-
size
public int size()Returns the number of components in the mixture.- Returns:
- the number of components.
-
bic
public double bic(double[][] data) Returns the BIC score.- Parameters:
data
- the data to calculate likelihood.- Returns:
- the BIC score.
-
toString
-