GaussianMixtureModel Class |
Namespace: Accord.MachineLearning
[SerializableAttribute] public class GaussianMixtureModel : ParallelLearningBase, IUnsupervisedLearning<GaussianClusterCollection, double[], int>, IClusteringAlgorithm<double[], double>, IClusteringAlgorithm<double[]>, IUnsupervisedLearning<IClusterCollection<double[]>, double[], int>
The GaussianMixtureModel type exposes the following members.
Name | Description | |
---|---|---|
GaussianMixtureModel(Int32) |
Initializes a new instance of the GaussianMixtureModel class.
| |
GaussianMixtureModel(KMeans) |
Initializes a new instance of the GaussianMixtureModel class.
| |
GaussianMixtureModel(MixtureNormalDistribution) |
Initializes a new instance of the GaussianMixtureModel class.
| |
GaussianMixtureModel(MultivariateMixtureMultivariateNormalDistribution) |
Initializes a new instance of the GaussianMixtureModel class.
|
Name | Description | |
---|---|---|
Clusters | Obsolete.
Gets the collection of clusters currently modeled by the
clustering algorithm.
| |
ComputeLabels |
Gets or sets whether cluster labels should be computed
at the end of the learning iteration. Setting to False
might save a few computations in case they are not necessary.
| |
ComputeLogLikelihood |
Gets or sets whether the log-likelihood should be computed
at the end of the learning iteration. Setting to False
might save a few computations in case they are not necessary.
| |
Gaussians |
Gets the Gaussian components of the mixture model.
| |
Initializations |
Gets or sets how many random initializations to try.
Default is 3.
| |
Iterations |
Gets how many iterations have been performed in the last call
to Compute(Double).
| |
LogLikelihood |
Gets the log-likelihood of the model at the last iteration.
| |
MaxIterations |
Gets or sets the maximum number of iterations to
be performed by the method. If set to zero, no
iteration limit will be imposed. Default is 0.
| |
Options |
Gets or sets the fitting options for the component
Gaussian distributions of the mixture model.
| |
ParallelOptions |
Gets or sets the parallelization options for this algorithm.
(Inherited from ParallelLearningBase.) | |
Token |
Gets or sets a cancellation token that can be used
to cancel the algorithm while it is running.
(Inherited from ParallelLearningBase.) | |
Tolerance |
Gets or sets the convergence criterion for the
Expectation-Maximization algorithm. Default is 1e-3.
| |
UseLogarithm |
Gets or sets whether to make computations using the log
-domain. This might improve accuracy on large datasets.
|
Name | Description | |
---|---|---|
Compute(Double) | Obsolete.
Divides the input data into K clusters modeling each
cluster as a multivariate Gaussian distribution.
| |
Compute(Double, GaussianMixtureModelOptions) | Obsolete.
Divides the input data into K clusters modeling each
cluster as a multivariate Gaussian distribution.
| |
Compute(Double, Double) | Obsolete.
Divides the input data into K clusters modeling each
cluster as a multivariate Gaussian distribution.
| |
Compute(Double, Double) | Obsolete.
Divides the input data into K clusters modeling each
cluster as a multivariate Gaussian distribution.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
Initialize(KMeans) |
Initializes the model with initial values obtained
through a run of the K-Means clustering algorithm.
| |
Initialize(MixtureNormalDistribution) |
Initializes the model with initial values.
| |
Initialize(MultivariateMixtureMultivariateNormalDistribution) |
Initializes the model with initial values.
| |
Initialize(MultivariateNormalDistribution) |
Initializes the model with initial values.
| |
Initialize(NormalDistribution) |
Initializes the model with initial values.
| |
Initialize(Double, MultivariateNormalDistribution) |
Initializes the model with initial values.
| |
Initialize(Double, NormalDistribution) |
Initializes the model with initial values.
| |
Initialize(Double, Double) |
Initializes the model with initial values obtained
through a run of the K-Means clustering algorithm.
| |
Learn |
Learns a model that can map the given inputs to the desired outputs.
| |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToMixtureDistribution |
Gets a copy of the mixture distribution modeled by this Gaussian Mixture Model.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
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.) |
Accord.Math.Random.Generator.Seed = 0; // Test Samples double[][] samples = { new double[] { 0, 1 }, new double[] { 1, 2 }, new double[] { 1, 1 }, new double[] { 0, 7 }, new double[] { 1, 1 }, new double[] { 6, 2 }, new double[] { 6, 5 }, new double[] { 5, 1 }, new double[] { 7, 1 }, new double[] { 5, 1 } }; // Create a new Gaussian Mixture Model with 2 components GaussianMixtureModel gmm = new GaussianMixtureModel(2); // Estimate the Gaussian Mixture var clusters = gmm.Learn(samples); // Predict cluster labels for each sample int[] predicted = clusters.Decide(samples); // We can also obtain the log-likelihoods for each sample: double[] logLikelihoods = clusters.LogLikelihood(samples); // As well as the probability of belonging to each cluster double[][] probabilities = clusters.Probabilities(samples);