# Equivalence between LC-CRF and HMM, and Discriminative Computing of HMM-Based MPM and MAP
## 4 Discriminative Classifiers in Generative HMMs
### Discriminative Computing of HMM-Based MPM
Let us define \"discriminative forward\" quantities \(\alpha_{1}^{D}(x_{1}),\ldots,\alpha_{N}^{D}(x_{N})\), and \"discriminative backward\" ones \(\beta_{1}^{D}(x_{1})\), \(\ldots,\beta_{N}^{D}(x_{N})\)by the following forward and backward recursions:_  
\[p(x_{n}|y_{1:N})=\frac{\sum_{(x_{1:n-1},x_{n+1:N})}p(x_{1}|y_{1})\prod_{t=2}^{N }p(x_{n}|x_{n-1})\frac{p(x_{n}|y_{n})}{p(x_{n})}}{\sum_{(x_{1:N})}p(x_{1}|y_{1 })\prod_{t=2}^{N}p(x_{n}|x_{n-1})\frac{p(x_{n}|y_{n})}{p(x_{n})}} \tag{22}\]0  
\[p(x_{n}|y_{1:N})=\frac{\sum_{(x_{1:n-1},x_{n+1:N})}p(x_{1}|y_{1})\prod_{t=2}^{N }p(x_{n}|x_{n-1})\frac{p(x_{n}|y_{n})}{p(x_{n})}}{\sum_{(x_{1:N})}p(x_{1}|y_{1 })\prod_{t=2}^{N}p(x_{n}|x_{n-1})\frac{p(x_{n}|y_{n})}{p(x_{n})}} \tag{22}\]1  
_then_  
\[p(x_{n}|y_{1:N})=\frac{\sum_{(x_{1:n-1},x_{n+1:N})}p(x_{1}|y_{1})\prod_{t=2}^{N }p(x_{n}|x_{n-1})\frac{p(x_{n}|y_{n})}{p(x_{n})}}{\sum_{(x_{1:N})}p(x_{1}|y_{1 })\prod_{t=2}^{N}p(x_{n}|x_{n-1})\frac{p(x_{n}|y_{n})}{p(x_{n})}} \tag{22}\]2  
_Consequently, we can compute the MPM classifier in a discriminative manner, only using \(p(x_{1}),\ldots,p(x_{N})\), \(p(x_{2}|x_{1}),\ldots,p(x_{N}|x_{N-1})\), and \(p(x_{1}|y_{1}),\ldots,p(x_{N}|y_{N})\)._  
Note that this result is similar to the result in [21], with a different proof. Remark 1: _Let us notice that according to Equations (31) and (32), it is possible to compute \(\alpha_{n}^{D}(x_{n})\)and\(\beta_{n}^{D}(x_{n})\) by a very slight adaptation of classic computing programs giving classic \(\alpha_{n}(x_{n})=p(x_{n},y_{1:n})\) and \(\beta_{n}(x_{n})=p(y_{n+1:N}|x_{n})\) with recursions (Equations (26) and (27)).__All we have to do is to replace\((y_{n+1}|x_{n+1})\) with \(\frac{p(x_{n+1}|y_{n+1})}{p(x_{n+1})}\). Of course, \(\alpha_{n}^{D}(x_{n})\
eq p(x_{n},y_{1:n})\) and\(\beta_{n}^{D}(x_{n})\
eq p(y_{n+1:N}|x_{n})\), but (Equation (33)) holds and thus \(p(x_{n}|y_{1:N})\) is computable allowing MDM._  
**Remark 2**. : _We see that we can compute the MPM in HMM only using \(p(x_{1})\),..., \(p(x_{N})\), \(p(x_{2}|x_{1})\),...,\(p(x_{N}|x_{N-1})\), and \(p(x_{1}|y_{1})\),..., \(p(x_{N}|y_{N})\). This means that in supervised classification, where we have a learn sample, we can use any parametrization to estimate them. For example, we can model them with logistic regression, as currently done in CRFs. It is of importance to note that such a parametrization is unusual; however, what is important is that the model remains the same._  
**Remark 3**. : _When using the MPM to deal with a concrete problem, Proposition 2 implies that talking about a comparison between LC-CRFs and HMMs is somewhat incorrect. Indeed, there is only one model. However, there are two different parameterizations, and this can produce two different results. Indeed, the estimation of the parameters can give two models of the same nature (posterior distribution of an HMM) but unequally situated with respect to the optimal model, the best suited to the data. It would therefore be more correct to speak of a comparison of two parametrizations of HMM, each associated with its own parameter estimator. The same is true concerning the MAP discussed in the next paragraph._