# HMM - derivative of the log-probability of the observations knowing the parameters

I'd like to use $P(O_{0..T}|\lambda)$ (probability of a sequence of observations knowing the hmm parameters) as a regularisation energy in an optimisation framework.

The dimensionality of the observations is 1 and the emission probability of each hidden state follow a normal law (I may generalise to n-dimensions and multinomial law later).

So : $P(O_{0..T}|\lambda) = \sum\limits_{j=0}^N((\sum\limits_{i=0}^N(\alpha_{T-1}^i a_{i,j})) \frac{1}{\sigma_j \sqrt{2\pi}} e^{-\frac{1}{2}\frac{(O_T-\mu_j)^2}{\sigma_j^2}})$ with $N$ the number of hidden states, $\alpha_t^j = P(O_{0..t}, S_t=j | \lambda)$, $a_{i,j}$ the transition probability from the state $i$ to the state $j$, $\mu_j$ the mean of the $j^{th}$ state and $\sigma_j$ the standard deviation of the $j^{th}$ state.

I want to find the observation $O_T$ that maximize the following energy : $P_{spatial} \times P_{temporal}$. Where $P_{spatial}$ is a pdf for which I know the derivative over $O_T$ of its logarithm and $P_{temporal}$ is my hmm probability.

Doing this is the same as finding the minimum of : $E=-ln(P_{spatial}) - ln(P_{temporal})$.

To use it in a Newton-like optimization framework I still need to get the derivative of the energy, i.e. : $\frac{\partial E}{\partial O_T} = -\frac{\partial ln(P_{spatial})}{\partial O_T} - \frac{\partial P_{temporal}}{\partial O_T}$.

As said previously, I have the $\frac{\partial ln(P_{spatial})}{\partial O_T}$ part of the equation but I didn't succeeded in finding a nice expression of $\frac{\partial ln(P_{temporal})}{\partial O_T}$ because of the summation in the logarithm. My question is the following : does such an expression exist or should I find another way to resolve my problem ?

This is a false problem, I do not need to know the logarithm of the summation because it disappears when making derivation $(ln(f)' = \frac{f'}{f})$. Sometimes I may be sily...