示例#1
0
 private void accumulateMean(int num, TrainerScore trainerScore)
 {
     if (num == -1)
     {
         for (int i = 0; i < this.senonePool.size(); i++)
         {
             this.accumulateMean(i, trainerScore);
         }
     }
     else
     {
         GaussianMixture    gaussianMixture   = (GaussianMixture)this.senonePool.get(num);
         MixtureComponent[] mixtureComponents = gaussianMixture.getMixtureComponents();
         for (int j = 0; j < mixtureComponents.Length; j++)
         {
             float[] mean = mixtureComponents[j].getMean();
             int     num2 = ((Integer)this.indexMap.get(mean)).intValue();
             if (!HMMPoolManager.assertionsDisabled && num2 < 0)
             {
                 throw new AssertionError();
             }
             if (!HMMPoolManager.assertionsDisabled && num2 != num)
             {
                 throw new AssertionError();
             }
             Buffer   buffer = (Buffer)this.meansBufferPool.get(num2);
             float[]  values = ((FloatData)trainerScore.getData()).getValues();
             double[] array  = new double[values.Length];
             float    num3   = trainerScore.getComponentGamma()[j];
             num3 -= this.currentLogLikelihood;
             double num4 = this.logMath.logToLinear(num3);
             for (int k = 0; k < array.Length; k++)
             {
                 array[k] = (double)values[k] * num4;
             }
             buffer.accumulate(array, num4);
         }
     }
 }
示例#2
0
 private void accumulateVariance(int num, TrainerScore trainerScore)
 {
     if (num == -1)
     {
         for (int i = 0; i < this.senonePool.size(); i++)
         {
             this.accumulateVariance(i, trainerScore);
         }
     }
     else
     {
         GaussianMixture    gaussianMixture   = (GaussianMixture)this.senonePool.get(num);
         MixtureComponent[] mixtureComponents = gaussianMixture.getMixtureComponents();
         for (int j = 0; j < mixtureComponents.Length; j++)
         {
             float[]  mean     = mixtureComponents[j].getMean();
             float[]  variance = mixtureComponents[j].getVariance();
             int      id       = ((Integer)this.indexMap.get(variance)).intValue();
             Buffer   buffer   = (Buffer)this.varianceBufferPool.get(id);
             float[]  values   = ((FloatData)trainerScore.getData()).getValues();
             double[] array    = new double[values.Length];
             float    num2     = trainerScore.getComponentGamma()[j];
             num2 -= this.currentLogLikelihood;
             double num3 = this.logMath.logToLinear(num2);
             for (int k = 0; k < array.Length; k++)
             {
                 array[k] = (double)(values[k] - mean[k]);
                 double[] array2 = array;
                 int      num4   = k;
                 double[] array3 = array2;
                 array3[num4] *= array[k] * num3;
             }
             buffer.accumulate(array, num3);
         }
     }
 }