MultivariateMixtureT Class |
Namespace: Accord.Statistics.Distributions.Multivariate
[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[]>
The MultivariateMixtureT type exposes the following members.
Name | Description | |
---|---|---|
MultivariateMixtureT(T) |
Initializes a new instance of the MultivariateMixtureT class.
| |
MultivariateMixtureT(Double, T) |
Initializes a new instance of the MultivariateMixtureT class.
|
Name | Description | |
---|---|---|
Coefficients |
Gets the weight coefficients.
| |
Components |
Gets the mixture components.
| |
Covariance |
Gets the variance-covariance matrix for this distribution.
(Overrides MultivariateContinuousDistributionCovariance.) | |
Dimension |
Gets the number of variables for this distribution.
(Inherited from MultivariateContinuousDistribution.) | |
Mean |
Gets the mean for this distribution.
(Overrides MultivariateContinuousDistributionMean.) | |
Median |
Gets the median for this distribution.
(Inherited from MultivariateContinuousDistribution.) | |
Mode |
Gets the mode for this distribution.
(Inherited from MultivariateContinuousDistribution.) | |
Variance |
Gets the variance vector for this distribution.
(Overrides MultivariateContinuousDistributionVariance.) |
Name | Description | |
---|---|---|
Clone |
Creates a new object that is a copy of the current instance.
(Overrides DistributionBaseClone.) | |
ComplementaryDistributionFunction |
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.) | |
DistributionFunction(Double) |
Gets the probability density function (pdf) for
this distribution evaluated at point x.
(Inherited from MultivariateContinuousDistribution.) | |
DistributionFunction(Int32, Double) |
Gets the cumulative distribution function (cdf) for one
of the component distributions evaluated at point x.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Estimate(Double, T) |
Estimates a new mixture model from a given set of observations.
| |
Estimate(Double, Double, T) |
Estimates a new mixture model from a given set of observations.
| |
Estimate(Double, Double, Double, T) |
Estimates a new mixture model from a given set of observations.
| |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
Fit(Double) |
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.) | |
Fit(Double, IFittingOptions) |
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.) | |
Fit(Double, Double) |
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.) | |
Fit(Double, Int32) |
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.) | |
Fit(Double, Int32, IFittingOptions) |
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.) | |
Fit(Double, Double, IFittingOptions) |
Fits the underlying distribution to a given set of observations.
(Overrides MultivariateContinuousDistributionFit(Double, Double, IFittingOptions).) | |
Fit(Double, Double, MixtureOptions) |
Fits the underlying distribution to a given set of observations.
| |
Generate |
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.) | |
Generate(Double) |
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.) | |
Generate(Int32) |
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateContinuousDistribution.) | |
Generate(Int32) |
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.) | |
Generate(Random) |
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.) | |
Generate(Double, Random) |
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.) | |
Generate(Int32, Double) |
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateContinuousDistribution.) | |
Generate(Int32, Int32) |
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateContinuousDistribution.) | |
Generate(Int32, Random) |
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateContinuousDistribution.) | |
Generate(Int32, Random) |
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.) | |
Generate(Int32, Int32, Random) |
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateContinuousDistribution.) | |
Generate(Int32, Double, Random) |
Generates a random vector of observations from the current distribution.
(Overrides MultivariateContinuousDistributionGenerate(Int32, Double, Random).) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
InnerComplementaryDistributionFunction |
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.) | |
InnerDistributionFunction |
Gets the cumulative distribution function (cdf) for
this distribution evaluated at point x.
(Overrides MultivariateContinuousDistributionInnerDistributionFunction(Double).) | |
InnerLogProbabilityDensityFunction |
Gets the log-probability density function (pdf) for
this distribution evaluated at point x.
(Overrides MultivariateContinuousDistributionInnerLogProbabilityDensityFunction(Double).) | |
InnerProbabilityDensityFunction |
Gets the probability density function (pdf) for
this distribution evaluated at point x.
(Overrides MultivariateContinuousDistributionInnerProbabilityDensityFunction(Double).) | |
LogLikelihood(Double) |
Computes the log-likelihood of the distribution
for a given set of observations.
| |
LogLikelihood(Double, Double) |
Computes the log-likelihood of the distribution
for a given set of observations.
| |
LogProbabilityDensityFunction(Double) |
Gets the log-probability density function (pdf)
for this distribution evaluated at point x.
(Inherited from MultivariateContinuousDistribution.) | |
LogProbabilityDensityFunction(Int32, Double) |
Gets the log-probability density function (pdf) for one
of the component distributions evaluated at point x.
| |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ProbabilityDensityFunction(Double) |
Gets the probability density function (pdf) for
this distribution evaluated at point x.
(Inherited from MultivariateContinuousDistribution.) | |
ProbabilityDensityFunction(Int32, Double) |
Gets the probability density function (pdf) for one of
the component distributions evaluated at point x.
| |
ToString |
Returns a String that represents this instance.
(Inherited from DistributionBase.) | |
ToString(IFormatProvider) |
Returns a String that represents this instance.
(Inherited from DistributionBase.) | |
ToString(String) |
Returns a String that represents this instance.
(Inherited from DistributionBase.) | |
ToString(String, IFormatProvider) |
Returns a String that represents this instance.
(Overrides DistributionBaseToString(String, IFormatProvider).) |
Name | Description | |
---|---|---|
HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |
IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |
To(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.) | |
ToT | 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.) |
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:
// 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)