Hello,

I am trying to use the “pyro.markov” in order to model a hidden Markov model. My model follows the exact structure as below code. Now, here is the problem that although the outputs key params make sense and distinguish between different steps of “x_t”, I wonder if the “pyro.markov” simulates the behavior that I expect from the HMM correctly or not. I doubt the proper functionality of this object, as the “render_model” that I receive does not reflect any connections (with arrows) between the latent variables of “x_t” (sequential that can be seen between the latents parameters in HMM). Am I missing something in the usage of “pyro.markov”? Or the connection holds at each step, but the render cannot reflect it? I would be grateful if you could help me with this confusion. Thank you in advance!

def state_space_model(data, N=1, T=2, prior_drift=0.):

# global rvs

drift = pyro.sample(‘drift’, dist.Normal(prior_drift, 1))

vol = pyro.sample(‘vol’, dist.LogNormal(0, 1))

uncert = pyro.sample(‘uncert’, dist.LogNormal(-5, 1))`latent = torch.empty((T, N)) with pyro.plate('data_plate', N) as n: x0 = pyro.sample('x0', dist.Normal(drift, vol)) # or whatever your IC might be latent[0, n] = x0 for t in pyro.markov(range(1, T)): x_t = pyro.sample(f"x_{t}",dist.Normal(latent[t - 1, n] + drift, vol)) y_t = pyro.sample(f"y_{t}",dist.Normal(x_t, uncert),obs=data[t - 1, n]) latent[t, n] = x_t return pyro.deterministic('latent', latent)`

pyro.render_model(model, model_args=(data))