How to parametrize hierarchical hidden markov model?

In ordinary HMM states trasitions are encoded by the matrix of probabilities. In HHMM some parameters are constantly equal to 0 or 1. Is there any mechanism in pyro to mark only some elements of matrix as parameter and leave other as constansts?

you can do this by hand using PyTorch tensor ops.

for example if you have

# define 4 totally unconstrained parameters 
# (one of which won't be used; see below)
M = pyro.param("my_matrix", torch.rand(2,2)). 

you can then create M2 and use M2 where needed

mask = torch.tensor([[1,1],[0,1]])
# M2 is in effect defined by 3 parameters
M2 = M * mask

Hi, Martin!
Thank you for reply!
I guess * is an ordinary matrix multiplication. Is there a Kronecker product in pytorch?

questions about pytorch are probably best answered by looking at the pytorch docs. note, however, that you don’t need to do everything in pytorch. e.g. if you want to create a static mask of a particular form, you can do that in numpy and then move the tensor to pytorch.