NormalMixture regression

Maybe you could try to tile the second process’ mu M times to end up with an M x 1 vector with the same variable (or value) repeated M times. That way you would be able to get a nice stack of equally shaped mu tensors and use the NormalMixture.

I think that the tile operation should be something like this

...
_mu2 = pm.Normal('mu2', 0, 1) # Note that mu2 is a scalar
# First we convert mu2 to a (1, 1) shaped array
mu2 = tt.shape_padleft(_mu2, 2)
# Next we tile the (1, 1) array (M, 1) times to end with a (M, 1) shaped array
mu2 = tt.tile(mu2, reps=[M, 1])
...

I’m not entirely sure if this will work well because mu2's shape will be symbolic and would require an .eval() or theano.function() to compute, but try it out.

1 Like