Recovering latent variable GaussianHMM

Hello everyone,

I am working on time-series models and I would like to recover the latent state of a noise distribution generated by GaussianHMM() in the pyro.contrib.forecasting framework.

More specifically, If I am fitting a space state model with the following observation equation:

y_t = A x_t + B e_t

And the transition equation

x_t = C x_{t-1} + D u_t

I would like to recover the path of the vector x_t.

Ideally, there would be a site for each x_t and I could just use Predictive() and look at the relevant sampled sites.

Thank you in advance!

Loic

1 Like

Hi @LBa, GaussianHMM marginalizes hidden states x_t so no path of x_t is generated during inference. Given the inferred C and D, you can generate a batch of noises u_t and use linear_integrate to get a path of x_t.

@fritzo Could you give your opinion?

Thank you @fehiepsi for the precision, I will implement my own Kalman filter to recover the most likely path of the variable x_t once the model is fitted. :slight_smile:

@LBa Are you willing to share your solution? Iā€™m facing the same problem.