简体   繁体   English

基本隐马尔可夫模型,维特比算法

[英]Basic Hidden Markov Model, Viterbi algorithm

I am fairly new to Hidden Markov Models and I am trying to wrap my head around a pretty basic part of the theory. 我对隐马尔可夫模型相当新,我试图围绕理论的一个非常基本的部分。

I would like to use a HMM as a classifier, so, given a time series of data I have two classes: background and signal. 我想使用HMM作为分类器,因此,给定一个时间序列的数据,我有两个类:背景和信号。

How are the emission probabilities estimated for each class? 如何估算每个班级的排放概率? Does the Viterbi algorithm need a template of the background and signal to estimate prob(data|state)? 维特比算法是否需要背景模板和信号来估计概率(数据|状态)? Or have I completely missed the point? 或者我完全错过了这一点?

To do classification with Viterbi you need to already know the model parameters. 要使用Viterbi进行分类,您需要已经知道模型参数。
Background and Signal are your two hidden states. 背景和信号是你的两个隐藏状态。 With the model parameters and observed data you want to use Viterbi to calculate the most likely sequence of hidden states. 使用模型参数和观察数据,您希望使用Viterbi计算最可能的隐藏状态序列。

To quote the hmmlearn documentation : 引用hmmlearn文档

The HMM is a generative probabilistic model, in which a sequence of observable X variables is generated by a sequence of internal hidden states Z. The hidden states are not be observed directly. HMM是一种生成概率模型,其中一系列可观察的X变量由一系列内部隐藏状态Z生成。隐藏状态不能直接观察到。 The transitions between hidden states are assumed to have the form of a (first-order) Markov chain. 假设隐藏状态之间的转换具有(一阶)马尔可夫链的形式。 They can be specified by the start probability vector π and a transition probability matrix A. The emission probability of an observable can be any distribution with parameters θ conditioned on the current hidden state. 它们可以由起始概率向量π和转移概率矩阵A指定。可观察的发射概率可以是具有以当前隐藏状态为条件的参数θ的任何分布。 The HMM is completely determined by π, A and θ HMM完全由π,A和θ确定

.

There are three fundamental problems for HMMs: HMM有三个基本问题:

 Given the model parameters and observed data, estimate the optimal sequence of hidden states. Given the model parameters and observed data, calculate the likelihood of the data. Given just the observed data, estimate the model parameters. 

The first and the second problem can be solved by the dynamic programming algorithms known as the Viterbi algorithm and the Forward-Backward algorithm, respectively. 第一和第二个问题可以分别通过称为维特比算法和前向后向算法的动态编程算法来解决。 The last one can be solved by an iterative Expectation-Maximization (EM) algorithm, known as the Baum-Welch algorithm. 最后一个可以通过迭代期望最大化(EM)算法来解决,该算法被称为Baum-Welch算法。

So we've got two states for our Hidden Markov model, noise and signal. 所以我们的隐马尔可夫模型,噪声和信号有两种状态。 We also must have something we observe, which could be ones and zeroes. 我们也必须有一些我们观察到的东西,可能是零和零。 Basically, ones are signal and zeroes are noise, but you get a few zeros mixed in with your signal and a few ones with the noise. 基本上,信号和零都是噪声,但是你的信号中会混入一些零,而噪声则会产生一些零。 So you need to know 所以你需要知道

Probablity of 0,1 when in the "noise" state 
Probability of 0,1 when in the "signal" state  
Probability of transitioning to "signal" when in the "noise" state. 
Probability of transitioning to "noise" when in the "signal" state.

So we keep track of the probability of each state for each time slot and, crucially, the most likely route we got there (based on the transition probabilities). 因此,我们跟踪每个时段的每个状态的概率,最重要的是,我们到达那里的最可能路线(基于转换概率)。 Then we assume that the most probable state at the end of the time series is our actual final state, and trace backwards. 然后我们假设时间序列结束时最可能的状态是我们的实际最终状态,并向后追踪。

The Viterbi Algorithm requires to know the HMM. 维特比算法需要知道HMM。

The HMM can be estimated with a Maximum-Likely-Estimation (MLE) and it's called the Baum–Welch algorithm . 可以使用最大可能估计(MLE)来估计HMM,并将其称为Baum-Welch算法

If you have trouble with the Viterbi Algorithm there's a working implementation here 如果您在使用Viterbi算法时遇到问题,那么这里有一个可行的实现

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM