资源简介
非常全面的HMM工具箱,隐马尔可夫matlab工具
代码片段和文件信息
function [LL prior transmat obsmat nrIterations] = ...
dhmm_em(data prior transmat obsmat varargin)
% LEARN_DHMM Find the ML/MAP parameters of an HMM with discrete outputs using EM.
% [ll_trace prior transmat obsmat iterNr] = learn_dhmm(data prior0 transmat0 obsmat0 ...)
%
% Notation: Q(t) = hidden state Y(t) = observation
%
% INPUTS:
% data{ex} or data(ex:) if all sequences have the same length
% prior(i)
% transmat(ij)
% obsmat(io)
%
% Optional parameters may be passed as ‘param_name‘ param_value pairs.
% Parameter names are shown below; default values in [] - if none argument is mandatory.
%
% ‘max_iter‘ - max number of EM iterations [10]
% ‘thresh‘ - convergence threshold [1e-4]
% ‘verbose‘ - if 1 print out loglik at every iteration [1]
% ‘obs_prior_weight‘ - weight to apply to uniform dirichlet prior on observation matrix [0]
%
% To clamp some of the parameters so learning does not change them:
% ‘adj_prior‘ - if 0 do not change prior [1]
% ‘adj_trans‘ - if 0 do not change transmat [1]
% ‘adj_obs‘ - if 0 do not change obsmat [1]
%
% Modified by Herbert Jaeger so xi are not computed individually
% but only their sum (over time) as xi_summed; this is the only way how they are used
% and it saves a lot of memory.
[max_iter thresh verbose obs_prior_weight adj_prior adj_trans adj_obs] = ...
process_options(varargin ‘max_iter‘ 10 ‘thresh‘ 1e-4 ‘verbose‘ 1 ...
‘obs_prior_weight‘ 0 ‘adj_prior‘ 1 ‘adj_trans‘ 1 ‘adj_obs‘ 1);
previous_loglik = -inf;
loglik = 0;
converged = 0;
num_iter = 1;
LL = [];
if ~iscell(data)
data = num2cell(data 2); % each row gets its own cell
end
while (num_iter <= max_iter) & ~converged
% E step
[loglik exp_num_trans exp_num_visits1 exp_num_emit] = ...
compute_ess_dhmm(prior transmat obsmat data obs_prior_weight);
% M step
if adj_prior
prior = normalise(exp_num_visits1);
end
if adj_trans & ~isempty(exp_num_trans)
transmat = mk_stochastic(exp_num_trans);
end
if adj_obs
obsmat = mk_stochastic(exp_num_emit);
end
if verbose fprintf(1 ‘iteration %d loglik = %f\n‘ num_iter loglik); end
num_iter = num_iter + 1;
converged = em_converged(loglik previous_loglik thresh);
previous_loglik = loglik;
LL = [LL loglik];
end
nrIterations = num_iter - 1;
%%%%%%%%%%%%%%%%%%%%%%%
function [loglik exp_num_trans exp_num_visits1 exp_num_emit exp_num_visitsT] = ...
compute_ess_dhmm(startprob transmat obsmat data dirichlet)
% COMPUTE_ESS_DHMM Compute the Expected Sufficient Statistics for an HMM with discrete outputs
% function [loglik exp_num_trans exp_num_visits1 exp_num_emit exp_num_visitsT] = ...
% compute_ess_dhmm(startprob transmat obsmat data dirichlet)
%
% INPUTS:
% startprob(i)
% transmat(ij)
% obsmat(io)
% data{seq}(t)
% dirichlet - weighting term for uniform dirichlet prior on expected emissions
%
% OUTPUTS:
% exp_num_trans(ij) = sum_l sum_{t=2}^T Pr(X(t-1) = i X(t) = j| Obs(l))
% exp_num_vis
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6896 2006-02-17 19:51 HMMall\HMM\#fwdback.m#
文件 5589 2006-02-16 18:49 HMMall\HMM\#mhmm_em.m#
文件 550 2005-06-08 18:22 HMMall\HMM\#README.txt#
文件 4081 2005-06-08 18:25 HMMall\HMM\dhmm_em.m
文件 687 2003-05-04 15:01 HMMall\HMM\dhmm_em_demo.m
文件 2376 2003-05-04 15:02 HMMall\HMM\dhmm_em_online.m
文件 2249 2003-05-04 15:04 HMMall\HMM\dhmm_em_online_demo.m
文件 640 2003-05-04 15:01 HMMall\HMM\dhmm_logprob.m
文件 552 2002-05-29 08:59 HMMall\HMM\dhmm_logprob_brute_force.m
文件 448 2002-05-29 08:59 HMMall\HMM\dhmm_logprob_path.m
文件 408 2004-05-31 15:19 HMMall\HMM\dhmm_sample.m
文件 622 2003-05-04 15:00 HMMall\HMM\dhmm_sample_endstate.m
文件 2096 2003-01-22 09:56 HMMall\HMM\fixed_lag_smoother.m
文件 987 2005-06-08 18:27 HMMall\HMM\fixed_lag_smoother_demo.m
文件 6896 2006-02-17 19:51 HMMall\HMM\fwdback.m
文件 6518 2006-02-16 18:30 HMMall\HMM\fwdback.m~
文件 6642 2005-12-08 23:41 HMMall\HMM\fwdback_xi.m
文件 1899 2006-02-23 14:34 HMMall\HMM\fwdprop_backsample.m
文件 1898 2006-02-22 11:15 HMMall\HMM\fwdprop_backsample.m~
文件 1561 2004-02-12 15:08 HMMall\HMM\gausshmm_train_observed.m
文件 10449 2005-05-12 09:52 HMMall\HMM\herbert.txt~
文件 442 2004-05-24 15:26 HMMall\HMM\mc_sample.m
文件 711 2003-01-22 12:32 HMMall\HMM\mc_sample_endstate.m
文件 490 2002-05-29 08:59 HMMall\HMM\mdp_sample.m
文件 1203 2004-02-13 18:06 HMMall\HMM\mhmmParzen_train_observed.m
文件 5610 2006-02-16 18:55 HMMall\HMM\mhmm_em.m
文件 5562 2004-02-07 20:52 HMMall\HMM\mhmm_em.m~
文件 1013 2003-05-13 09:11 HMMall\HMM\mhmm_em_demo.m
文件 960 2003-05-04 15:11 HMMall\HMM\mhmm_logprob.m
文件 1071 2004-05-25 17:32 HMMall\HMM\mhmm_sample.m
............此处省略472个文件信息
- 上一篇:三维曲线拟合函数的MATLAB程序
- 下一篇:Hamming.m
相关资源
- 三维曲线拟合函数的MATLAB程序
- matlab对光栅的仿真代码
- MATLAB读取ply文件程序
- matlab 图像形状识别
- lm算法的matlab实现
- 太阳板光照强度与板倾斜角和方位角
- matlab官方的arrow.m
- Matlab中LMI(线性矩阵不等式)工具箱
- 基于MATLAB的时域采样定理演示系统
- 完全自主研发的粒子群算法来求解约
- Matlab2014_(32and64).txt
- 惯性导航 MATLAB程序
- 基于卡尔曼滤波的目标跟踪matlab经典
- crc32的matlab程序
- 云模型的matlab实现
- matlab实现jpeg压缩过程_MATLAB程序
- Shape Context(matlab)
- lorenz混沌系统 MATLAB仿真
- 《无人驾驶车辆模型预测控制》书中
- 产生4FSK的matlab程序
- 基于MATLAB的SADSSD模板匹配算法
- 支持向量机matlab代码
- DOA与频率联合估计算法的MATLAB仿真
- 三维重建程序 MATLAB语言
- MATLAB代码最小风险贝叶斯决策
- CEEMD代码,matlab亲测可用
- MATLAB实现AM调制
- 太阳能电池matlabm模型
-
LQG主动悬架 maltab simuli
nk实现 - 双门限法语音信号端点检测matlab可实
评论
共有 条评论