예제 #1
0
        /// <summary>
        ///   Divides the input data into K clusters modeling each
        ///   cluster as a multivariate Gaussian distribution.
        /// </summary>
        ///
        public double Compute(double[][] data, GaussianMixtureModelOptions options)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            if (model == null)
            {
                // TODO: Perform K-Means multiple times to avoid
                //  a poor Gaussian Mixture model initialization.
                Initialize(data, options.Threshold);
            }

            // Create the mixture options
            var mixtureOptions = new MixtureOptions()
            {
                Threshold    = options.Threshold,
                InnerOptions = options.NormalOptions,
                Iterations   = options.Iterations,
                Logarithm    = options.Logarithm
            };

            // Check if we have weighted samples
            double[] weights = options.Weights;

            // Fit a multivariate Gaussian distribution
            model.Fit(data, weights, mixtureOptions);


            // Return the log-likelihood as a measure of goodness-of-fit
            return(model.LogLikelihood(data));
        }
예제 #2
0
        /// <summary>
        ///   Divides the input data into K clusters modeling each
        ///   cluster as a multivariate Gaussian distribution.
        /// </summary>
        ///
        public double Compute(double[][] data, double threshold)
        {
            var options = new GaussianMixtureModelOptions
            {
                Threshold = threshold
            };

            return(Compute(data, options));
        }
예제 #3
0
        /// <summary>
        ///   Divides the input data into K clusters modeling each
        ///   cluster as a multivariate Gaussian distribution.
        /// </summary>
        ///
        public double Compute(double[][] data, double threshold, double regularization)
        {
            var options = new GaussianMixtureModelOptions()
            {
                Threshold     = threshold,
                NormalOptions = new NormalOptions()
                {
                    Regularization = regularization
                }
            };

            return(Compute(data, options));
        }
예제 #4
0
        /// <summary>
        ///   Divides the input data into K clusters modeling each
        ///   cluster as a multivariate Gaussian distribution.
        /// </summary>
        ///
        public double Compute(double[][] data)
        {
            var options = new GaussianMixtureModelOptions();

            return(Compute(data, options));
        }