在Matlab中对序列进行分类的隐马尔可夫模型 [英] Hidden Markov model classifying a sequence in Matlab
问题描述
我是机器学习的新手,我了解了用于隐藏的Markov模型的Matlab统计工具箱,我想使用它对给定的信号序列进行分类.我在矩阵P
中使用3D坐标,即[501x3],我想以此为基础训练模型.转换完整轨迹的终点是一组特定的点,即达到目标的(0,0,0).
I'm very new to machine learning, I'v read about Matlab's Statistics toolbox for hidden Markov model, I want to classify a given sequence of signals using it. I'v 3D co-ordinates in matrix P
i.e [501x3] and I want to train model based on that. Evert complete trajectory ends on a specfic set of points, i.e at (0,0,0) where it achieves its target.
根据我的情况,合适的伪代码/方法是什么.
What is the appropriate Pseudocode/approach according to my scenario.
我的伪代码:
- 501x3矩阵
P
是发射矩阵,其中每个坐标均为状态 - 随机NxN个转换矩阵值(但我对此感到困惑)
- 使用功能
hmmgenerate
生成测试序列
- 使用
hmmtrain(sequence,old_transition,old_emission)
进行训练
- 将最终跃迁和发射矩阵赋予未知序列的
hmmdecode
,以给出概率(也令人困惑)
- 501x3 matrix
P
is Emission matrix where each co-ordinate is state - random NxN transition matrix values (but i'm confused in it)
- generating test sequence using the function
hmmgenerate
- train using
hmmtrain(sequence,old_transition,old_emission)
- give final transition and emission matrix to
hmmdecode
with an unknown sequence to give the probability (confusing also)
简而言之,我想用HMM对每个具有[501x3]
的10类轨迹进行分类.我想为每个轨迹采样50行,即[50x3]
以建立模型.但是,我使用HMM的murphyk's
工具箱来处理此类随机序列.
EDIT 1:
In a nutshell, I want to classify 10 classes of trajectories having each of [501x3]
with HMM. I want to sampled 50 rows i.e [50x3]
for each trajectory in order to build model. However, I'v murphyk's
toolbox of HMM for such random sequences.
推荐答案
该语句/案例告诉您构建和训练具有以下组成部分的隐马尔可夫模型,该模型具有以下组成部分,具体取决于选择,使用murphyk's
HMM工具箱:
The statement/case tells to build and train a hidden Markov's model having following components specially using murphyk's
toolbox for HMM as per the choice:
- O =观测的向量
- Q =状态向量
- T =向量序列
- nex =序列数
- M =混合物数量
演示代码(来自murphyk's
工具箱):
Demo Code (from murphyk's
toolbox):
O = 8; %Number of coefficients in a vector
T = 420; %Number of vectors in a sequence
nex = 1; %Number of sequences
M = 1; %Number of mixtures
Q = 6; %Number of states
data = randn(O,T,nex);
% initial guess of parameters
prior0 = normalise(rand(Q,1));
transmat0 = mk_stochastic(rand(Q,Q));
if 0
Sigma0 = repmat(eye(O), [1 1 Q M]);
% Initialize each mean to a random data point
indices = randperm(T*nex);
mu0 = reshape(data(:,indices(1:(Q*M))), [O Q M]);
mixmat0 = mk_stochastic(rand(Q,M));
else
[mu0, Sigma0] = mixgauss_init(Q*M, data, 'full');
mu0 = reshape(mu0, [O Q M]);
Sigma0 = reshape(Sigma0, [O O Q M]);
mixmat0 = mk_stochastic(rand(Q,M));
end
[LL, prior1, transmat1, mu1, Sigma1, mixmat1] = ...
mhmm_em(data, prior0, transmat0, mu0, Sigma0, mixmat0, 'max_iter', 5);
loglik = mhmm_logprob(data, prior1, transmat1, mu1, Sigma1, mixmat1);
这篇关于在Matlab中对序列进行分类的隐马尔可夫模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!