You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reproducible example: Let w be a categorical variable with values 0 or 1 (probability 0.5 each). Let x|w be a normal distribution with mean w and scale 0.01. this works in 1d:
The reason why this works builds mainly on the feature of numpy.random.normal which allows input like np.random.normal(np.array([0,10,20]), size=3), i.e., the mean can be provided in a vectorised format. This does not work for np.random.multivariate_normal, which is why the following example does not work:
chain_rule['z'] = dists.Cond(lambda x: dists.MvNormal(loc=x['w']*np.array([1,0]), scale=0.01), dim=2)
ValueError: operands could not be broadcast together with shapes (5,) (2,)
Fundamentally, I believe that the only recourse here is to sample the rvs sequentially, ie loop through the samples to be provided (sample w first, then w|z, and do this as many times as necessary). This will be much slower, of course.
The text was updated successfully, but these errors were encountered:
Reproducible example: Let w be a categorical variable with values 0 or 1 (probability 0.5 each). Let x|w be a normal distribution with mean w and scale 0.01. this works in 1d:
The reason why this works builds mainly on the feature of numpy.random.normal which allows input like
np.random.normal(np.array([0,10,20]), size=3)
, i.e., the mean can be provided in a vectorised format. This does not work for np.random.multivariate_normal, which is why the following example does not work:(we get the error)
Fundamentally, I believe that the only recourse here is to sample the rvs sequentially, ie loop through the samples to be provided (sample w first, then w|z, and do this as many times as necessary). This will be much slower, of course.
The text was updated successfully, but these errors were encountered: