为什么这个隐马尔可夫模型做出这个预测?

时间:2018-06-06 08:21:51

标签: c# machine-learning hidden-markov-models accord.net

我想了解HMM是如何工作的,但我想我错过了一些我无法识别的重要信息部分。我希望它根据给定的序列预测下一个“特征”/“符号”。

        int[][] sequences =
        {
            new[] { 10001, 15, 1, 0, 0, 10002 },
            new[] { 10002, 0, 1, 0, 15, 10001 },
            new[] { 101, 15, 0, 0, 0, 101},
            new[] { 101, 0, 0, 0, 15, 101 },
            new[] { 114, 15, 0, 1, 0, 114 },
            new[] { 114, 0, 0, 1, 15, 114 },
            new[] { 10001, 15, 1, 0, 0, 10002 },
            new[] { 10002, 0, 1, 0, 15, 10001 },
        };

        var teacher = new BaumWelchLearning()
        {
            Topology = new Forward(6),
            Tolerance = 0.0001,
        };

        HiddenMarkovModel hmm = teacher.Learn(sequences);

        // Gives 15 instead of 114
        int[] prediction = hmm.Predict(observations: new[] { 114, 15, 0, 1, 0 }, next: 1); 

“114,15,0,1,0”的下一个字符应该是114,但是预测是15.我是否在做拓扑错误?我需要以不同的方式定义某些内容吗?

提前致谢!

1 个答案:

答案 0 :(得分:1)

你不能使用统计/概率来预测一个单独的实现。当你在许多事件中使用它时,这个理论是有意义的。在你的情况下 打电话:

int[] prediction = hmm.Predict(observations: new[] { 114, 15, 0, 1, 0 },   next: 1);
很多次,看看下一个观察结果是什么。真的是......