从HMM高斯混合分布中获得下一个观测值 [英] Getting the next observation from a HMM gaussian mixture distribution

查看:219
本文介绍了从HMM高斯混合分布中获得下一个观测值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个长度为1000的连续单变量xts对象,已将其转换为一个名为x的data.frame,供程序包RHmm使用.

I have a continuous univariate xts object of length 1000, which I have converted into a data.frame called x to be used by the package RHmm.

我已经选择混合分布中将有5个状态和4个高斯分布.

I have already chosen that there are going to be 5 states and 4 gaussian distributions in the mixed distribution.

我追求的是下一次观察的预期平均值.我该如何获得它?

所以我到目前为止是:

  1. 运行HMMFit()函数的转换矩阵
  2. 混合物中每个高斯分布的一组均值和方差以及它们各自的比例,所有均由HMMFit()函数生成.
  3. 使用HMMFit函数的输出并将其放入viterbi函数时与输入数据有关的过去隐藏状态的列表
  1. a transition matrix from running the HMMFit() function
  2. a set of means and variances for each of the gaussian distributions in the mixture, along with their respective proportions, all of which was also generated form the HMMFit() function
  3. a list of past hidden states relating to the input data when using the output of the HMMFit function and putting it into the viterbi function

我将如何从已有数据中获取下一个隐藏状态(即第1001个值),然后使用它从高斯分布中获取加权均值.

How would I go about getting the next hidden state (i.e. the 1001st value) from what I've got, and then using it to get the weighted mean from the gaussian distributions.

我想我非常接近,只是不太确定下一个部分是什么...最后一个状态是状态5,是否以某种方式使用转换矩阵中的第5行来获取下一个状态?

I think I'm pretty close just not too sure what the next part is...The last state is state 5, do I use the 5th row in the transition matrix somehow to get the next state?

我所需要的只是在下一次观察中所期望的加权平均值,因此甚至不需要下一个隐藏状态.我是否将第5行中的概率乘以每种均值,并按每种状态的权重加权?然后将它们加在一起?

All I'm after is the weighted mean for what is to be expect in the next observation, so the next hidden state isn't even necessary. Do I multiply the probabilities in row 5 by each of the means, weighted to their proportion for each state? and then sum it all together?

这是我使用的代码.

# have used 2000 iterations to ensure convergence
a <- HMMFit(x, nStates=5, nMixt=4, dis="MIXTURE", control=list(iter=2000)
v <- viterbi(a,x)
a
v

一如既往,任何帮助将不胜感激!

As always any help would be greatly appreciated!

推荐答案

下一个预测值使用最后一个隐藏状态last(v$states)从分布矩阵a$HMM$distribution$mean加权的每个状态从转换矩阵a$HMM$transMat[last(v$states),]获取概率权重比例a$HMM$distribution$proportion,然后将其全部相乘并求和.因此,在上述情况下,将如下所示:

Next predicted value uses last hidden state last(v$states) to get probability weights from the transition matrix a$HMM$transMat[last(v$states),] for each state the distribution means a$HMM$distribution$mean are weighted by proportions a$HMM$distribution$proportion, then its all multiplied together and summed. So in the above case it would be as follows:

sum(a$HMM$transMat[last(v$states),] * .colSums((matrix(unlist(a$HMM$distribution$mean), nrow=4,ncol=5)) * (matrix(unlist(a$HMM$distribution$proportion), nrow=4,ncol=5)), m=4,n=5))

这篇关于从HMM高斯混合分布中获得下一个观测值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆