Hi,
I don’t understand why in this example, this shape is (5, 2)
cov = np.array([[1., 0.5], [0.5, 2]])
mu = np.zeros(2)
vals = pm.MvNormal('vals', mu=mu, cov=cov, shape=(5, 2))
Example taken from documentation of pm.MvNormal
.
Hi,
I don’t understand why in this example, this shape is (5, 2)
cov = np.array([[1., 0.5], [0.5, 2]])
mu = np.zeros(2)
vals = pm.MvNormal('vals', mu=mu, cov=cov, shape=(5, 2))
Example taken from documentation of pm.MvNormal
.
If you don’t specify shape, the distribution would end up with shape==(2,)
. In the example, the shape argument requests 5 “batch dimensions” and you end up with a matrix of 5 independent and identically distributed mvnornals each with length 2, for a final shape==(5, 2)
.
You can read more about this here: Distribution Dimensionality — PyMC 5.7.2 documentation