HMM工具箱命令使用说明.docxVIP

  1. 1、本文档共17页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  5. 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  6. 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  7. 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  8. 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
HOW TO USE THE HMM TOOLBOX (MATLAB)一、离散输出的隐马尔科夫模型(DHMM,HMM with discrete outputs)最大似然参数估计EM(Baum Welch算法)The script dhmm_em_demo.m gives an example of how to learn an HMM with discrete outputs. Let there be Q=2 states and O=3 output symbols. We create random stochastic matrices as follows.O = 3;Q = 2;prior0 = normalise(rand(Q,1));transmat0 = mk_stochastic(rand(Q,Q));obsmat0 = mk_stochastic(rand(Q,O));?Now we sample nex=20 sequences of length T=10 each from this model, to use as training data.T=10;?? %序列长度nex=20;? %样本序列数目data = dhmm_sample(prior0, transmat0, obsmat0, nex, T);??????Here data is?20x10. Now we make a random guess as to what the parameters are,prior1 = normalise(rand(Q,1)); %初始状态概率transmat1 = mk_stochastic(rand(Q,Q)); %初始状态转移矩阵obsmat1 = mk_stochastic(rand(Q,O)); %初始观测状态到隐藏状态间的概率转移矩阵and improve our guess using 5 iterations of EM...[LL, prior2, transmat2, obsmat2] = dhmm_em(data, prior1, transmat1, obsmat1, max_iter, 5);%prior2, transmat2, obsmat2 为训练好后的初始概率,状态转移矩阵及混合状态概率转移矩阵LL(t) is the log-likelihood after iteration t, so we can plot the learning curve.序列分类To evaluate the log-likelihood of a trained model given test data, proceed as follows:loglik = dhmm_logprob(data, prior2, transmat2, obsmat2)? %HMM测试Note: the discrete alphabet is assumed to be {1, 2, ..., O}, where O = size(obsmat, 2). Hence data cannot contain any 0s.To classify a sequence into one of k classes, train up k HMMs, one per class, and then compute the log-likelihood that each model gives to the test sequence; if the ith model is the most likely, then declare the class of the sequence to be class i.Computing the most probable sequence (Viterbi)First you need to evaluate B(i,t) = P(y_t | Q_t=i) for all t,i:B = multinomial_prob(data, obsmat);Then you can use[path] = viterbi_path(prior, transmat, B)??二、具有高斯混合输出的隐马尔科夫模型(GHMM,HMM with mixture of Gaussians outputs)Maximum likelihood parameter estimation using EM (Baum Welch)Let us generate nex=50 vector-valued sequences of length T=50; each vec

文档评论(0)

paobei_bb + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档