Exemplo n.º 1
0
    // Train the Hidden Markov Model
    public void TrainHMM()
    {
        // First reset it back to default values
        hmm.initialize();

        // Construct a list of symbol sequences representing all the training gestures
        List <List <int> > seqs = new List <List <int> >();

        foreach (Gesture g in gc.gestures)
        {
            seqs.Add(q.QuantizeGesture(g));
        }

        // train these equences
        hmm.train(seqs);

        // recompute the a priori probability
        // just compute the mean of all the probabilities of the training gestures
        DefaultProbability = 0.0f;
        foreach (Gesture g in gc.gestures)
        {
            DefaultProbability += MatchGesture(g);
        }
        DefaultProbability /= gc.gestures.Count;
    }