Click or drag to resize
Accord.NET (logo)

MultivariateMixtureT Class

Mixture of multivariate probability distributions.
Inheritance Hierarchy
SystemObject
  Accord.Statistics.DistributionsDistributionBase
    Accord.Statistics.Distributions.MultivariateMultivariateContinuousDistribution
      Accord.Statistics.Distributions.MultivariateMultivariateMixtureT

Namespace:  Accord.Statistics.Distributions.Multivariate
Assembly:  Accord.Statistics (in Accord.Statistics.dll) Version: 3.8.0
Syntax
[SerializableAttribute]
public class MultivariateMixture<T> : MultivariateContinuousDistribution, 
	IMixture<T>, IDistribution, ICloneable, IFittableDistribution<double[], MixtureOptions>, 
	IFittable<double[], MixtureOptions>, IFittable<double[]>, 
	IFittableDistribution<double[]>, IDistribution<double[]>, ISampleableDistribution<double[]>, 
	IRandomNumberGenerator<double[]>
where T : Object, IMultivariateDistribution<double[]>
Request Example View Source

Type Parameters

T
The type of the multivariate component distributions.

The MultivariateMixtureT type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyCoefficients
Gets the weight coefficients.
Public propertyComponents
Gets the mixture components.
Public propertyCovariance
Gets the variance-covariance matrix for this distribution.
(Overrides MultivariateContinuousDistributionCovariance.)
Public propertyDimension
Gets the number of variables for this distribution.
(Inherited from MultivariateContinuousDistribution.)
Public propertyMean
Gets the mean for this distribution.
(Overrides MultivariateContinuousDistributionMean.)
Public propertyMedian
Gets the median for this distribution.
(Inherited from MultivariateContinuousDistribution.)
Public propertyMode
Gets the mode for this distribution.
(Inherited from MultivariateContinuousDistribution.)
Public propertyVariance
Gets the variance vector for this distribution.
(Overrides MultivariateContinuousDistributionVariance.)
Top
Methods
  NameDescription
Public methodClone
Creates a new object that is a copy of the current instance.
(Overrides DistributionBaseClone.)
Public methodComplementaryDistributionFunction
Gets the complementary cumulative distribution function (ccdf) for this distribution evaluated at point x. This function is also known as the Survival function.
(Inherited from MultivariateContinuousDistribution.)
Public methodDistributionFunction(Double)
Gets the probability density function (pdf) for this distribution evaluated at point x.
(Inherited from MultivariateContinuousDistribution.)
Public methodDistributionFunction(Int32, Double)
Gets the cumulative distribution function (cdf) for one of the component distributions evaluated at point x.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodStatic memberEstimate(Double, T)
Estimates a new mixture model from a given set of observations.
Public methodStatic memberEstimate(Double, Double, T)
Estimates a new mixture model from a given set of observations.
Public methodStatic memberEstimate(Double, Double, Double, T)
Estimates a new mixture model from a given set of observations.
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodFit(Double)
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.)
Public methodFit(Double, IFittingOptions)
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.)
Public methodFit(Double, Double)
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.)
Public methodFit(Double, Int32)
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.)
Public methodFit(Double, Int32, IFittingOptions)
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.)
Public methodFit(Double, Double, IFittingOptions)
Fits the underlying distribution to a given set of observations.
(Overrides MultivariateContinuousDistributionFit(Double, Double, IFittingOptions).)
Public methodFit(Double, Double, MixtureOptions)
Fits the underlying distribution to a given set of observations.
Public methodGenerate
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.)
Public methodGenerate(Double)
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.)
Public methodGenerate(Int32)
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateContinuousDistribution.)
Public methodGenerate(Int32)
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.)
Public methodGenerate(Random)
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.)
Public methodGenerate(Double, Random)
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.)
Public methodGenerate(Int32, Double)
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateContinuousDistribution.)
Public methodGenerate(Int32, Int32)
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateContinuousDistribution.)
Public methodGenerate(Int32, Random)
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateContinuousDistribution.)
Public methodGenerate(Int32, Random)
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.)
Public methodGenerate(Int32, Int32, Random)
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateContinuousDistribution.)
Public methodGenerate(Int32, Double, Random)
Generates a random vector of observations from the current distribution.
(Overrides MultivariateContinuousDistributionGenerate(Int32, Double, Random).)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodInnerComplementaryDistributionFunction
Gets the complementary cumulative distribution function (ccdf) for this distribution evaluated at point x. This function is also known as the Survival function.
(Inherited from MultivariateContinuousDistribution.)
Protected methodInnerDistributionFunction
Gets the cumulative distribution function (cdf) for this distribution evaluated at point x.
(Overrides MultivariateContinuousDistributionInnerDistributionFunction(Double).)
Protected methodInnerLogProbabilityDensityFunction
Gets the log-probability density function (pdf) for this distribution evaluated at point x.
(Overrides MultivariateContinuousDistributionInnerLogProbabilityDensityFunction(Double).)
Protected methodInnerProbabilityDensityFunction
Gets the probability density function (pdf) for this distribution evaluated at point x.
(Overrides MultivariateContinuousDistributionInnerProbabilityDensityFunction(Double).)
Public methodLogLikelihood(Double)
Computes the log-likelihood of the distribution for a given set of observations.
Public methodLogLikelihood(Double, Double)
Computes the log-likelihood of the distribution for a given set of observations.
Public methodLogProbabilityDensityFunction(Double)
Gets the log-probability density function (pdf) for this distribution evaluated at point x.
(Inherited from MultivariateContinuousDistribution.)
Public methodLogProbabilityDensityFunction(Int32, Double)
Gets the log-probability density function (pdf) for one of the component distributions evaluated at point x.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodProbabilityDensityFunction(Double)
Gets the probability density function (pdf) for this distribution evaluated at point x.
(Inherited from MultivariateContinuousDistribution.)
Public methodProbabilityDensityFunction(Int32, Double)
Gets the probability density function (pdf) for one of the component distributions evaluated at point x.
Public methodToString
Returns a String that represents this instance.
(Inherited from DistributionBase.)
Public methodToString(IFormatProvider)
Returns a String that represents this instance.
(Inherited from DistributionBase.)
Public methodToString(String)
Returns a String that represents this instance.
(Inherited from DistributionBase.)
Public methodToString(String, IFormatProvider)
Returns a String that represents this instance.
(Overrides DistributionBaseToString(String, IFormatProvider).)
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodTo(Type)Overloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Public Extension MethodToTOverloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Top
Remarks

A mixture density is a probability density function which is expressed as a convex combination (i.e. a weighted sum, with non-negative weights that sum to 1) of other probability density functions. The individual density functions that are combined to make the mixture density are called the mixture components, and the weights associated with each component are called the mixture weights.

References:

Examples
// Randomly initialize some mixture components
MultivariateNormalDistribution[] components = new MultivariateNormalDistribution[2];
components[0] = new MultivariateNormalDistribution(new double[] { 2 }, new double[,] { { 1 } });
components[1] = new MultivariateNormalDistribution(new double[] { 5 }, new double[,] { { 1 } });

// Create an initial mixture
var mixture = new MultivariateMixture<MultivariateNormalDistribution>(components);

// Now, suppose we have a weighted data
// set. Those will be the input points:

double[][] points = new double[] { 0, 3, 1, 7, 3, 5, 1, 2, -1, 2, 7, 6, 8, 6 } // (14 points)
    .ToArray();

// And those are their respective unnormalized weights:
double[] weights = { 1, 1, 1, 2, 2, 1, 1, 1, 2, 1, 2, 3, 1, 1 }; // (14 weights)

// Let's normalize the weights so they sum up to one:
weights = weights.Divide(weights.Sum());

// Now we can fit our model to the data:
mixture.Fit(points, weights);   // done!

// Our model will be:
double mean1 = mixture.Components[0].Mean[0]; // 1.41126
double mean2 = mixture.Components[1].Mean[0]; // 6.53301

// With mixture coefficients
double pi1 = mixture.Coefficients[0]; // 0.51408489193241225
double pi2 = mixture.Coefficients[1]; // 0.48591510806758775

// If we need the GaussianMixtureModel functionality, we can
// use the estimated mixture to initialize a new model:
GaussianMixtureModel gmm = new GaussianMixtureModel(mixture);

mean1 = gmm.Gaussians[0].Mean[0]; // 1.41126 (same)
mean2 = gmm.Gaussians[1].Mean[0]; // 6.53301 (same)

p1 = gmm.Gaussians[0].Proportion; // 0.51408 (same)
p2 = gmm.Gaussians[1].Proportion; // 0.48591 (same)
See Also