Accord.Statistics.Models.Markov.Learning.ContinuousBaumWelchLearning.UpdateEmissions C# (CSharp) Method

UpdateEmissions() protected method

Updates the emission probability matrix.
Implementations of this method should use the observations in the training data and the Gamma probability matrix to update the probability distributions of symbol emissions.
protected UpdateEmissions ( ) : void
return void
        protected override void UpdateEmissions()
        {
            IDistribution[] B = model.Emissions;

            for (int i = 0; i < B.Length; i++)
            {
                double sum = 0;

                int w = 0;
                for (int k = 0; k < continuousObservations.Length; k++)
                {
                    int T = continuousObservations[k].Length;
                    double[,] gammak = Gamma[k];

                    for (int t = 0; t < T; t++, w++)
                        sum += weights[w] = gammak[t, i];
                }

                if (sum != 0)
                    for (int j = 0; j < weights.Length; j++)
                        weights[j] /= sum;

                B[i] = B[i].Fit(samples, weights);
            }
        }