Multivariate Normal with missing inputs

@junpenglao, a related question about the following line from your notebook:

for i, im in enumerate(uni_case):
    pm.MvNormal('obs%i'%(i), 
                mu[im == False],
                cov[im == False, :][:, im == False],
                observed=X_slice[np.sum(maskall == im, axis=1) > 0, :][:, im == False])

To observed we pass a sub-array (by which I mean an array of shape smaller than the full dataset), and mu and sigma are themselves sub-tensors. How then does our model know which marginal we’re working with?

To be more specific:

Say one of the observations is [--, .5, 1., --, .9] so the marginals I want to work with will be {X2, X3, X5}. observed gets [[.5, 1., .9]] and mu and sigma passed to MvNormal are sub-tensors. How does the model decide that these observations correspond to X2, X3 and X5 as opposed to, say, X1, X2 and X3 since we are not explicitly passing any mask to it?