public override double[][][] EstimateXi(IMLDataSet sequence,
                ForwardBackwardCalculator fbc, HiddenMarkovModel hmm)
        {
            if (sequence.Count <= 1)
            {
                throw new EncogError(
                        "Must have more than one observation");
            }

            double[][][] xi = EngineArray.AllocDouble3D((int)sequence.Count - 1, hmm
                    .StateCount, hmm.StateCount);

            for (int t = 0; t < (sequence.Count - 1); t++)
            {
                IMLDataPair observation = sequence[t+1];

                for (int i = 0; i < hmm.StateCount; i++)
                {
                    for (int j = 0; j < hmm.StateCount; j++)
                    {
                        xi[t][i][j] = fbc.AlphaElement(t, i)
                                * hmm.TransitionProbability[i][j]
                                * hmm.StateDistributions[j].Probability(
                                        observation) * fbc.BetaElement(t + 1, j);
                    }
                }
            }

            return xi;
        }
        protected double[][] EstimateGamma(double[][][] xi,
                                           ForwardBackwardCalculator fbc)
        {
            double[][] gamma = EngineArray.AllocateDouble2D(xi.Length + 1, xi[0].Length);

            for (int t = 0; t < (xi.Length + 1); t++)
            {
                EngineArray.Fill(gamma[t], 0.0);
            }

            for (int t = 0; t < xi.Length; t++)
            {
                for (int i = 0; i < xi[0].Length; i++)
                {
                    for (int j = 0; j < xi[0].Length; j++)
                    {
                        gamma[t][i] += xi[t][i][j];
                    }
                }
            }

            for (int j = 0; j < xi[0].Length; j++)
            {
                for (int i = 0; i < xi[0].Length; i++)
                {
                    gamma[xi.Length][j] += xi[xi.Length - 1][i][j];
                }
            }

            return gamma;
        }
 public abstract double[][][] EstimateXi(IMLDataSet sequence,
                                         ForwardBackwardCalculator fbc, HiddenMarkovModel hmm);