@junpenglao
Hello Thanks for this example. I am actually trying to reproduce this.
I got this error. pymc v3.8 on Window machine…
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-37-5266fc4ced7f> in <module>
29 mu = tt.concatenate([[0.], mu_hat])
30 #sd = pm.HalfCauchy('sigma', 1.)
---> 31 latent = pm.Normal('latent',
32 mu=mu[y_argsort],
33 sd=1., # using sd does not work yet
~\anaconda3\envs\building_normalization\lib\site-packages\pymc3\distributions\distribution.py in __new__(cls, name, *args, **kwargs)
45 total_size = kwargs.pop('total_size', None)
46 dist = cls.dist(*args, **kwargs)
---> 47 return model.Var(name, dist, data, total_size)
48 else:
49 raise TypeError("Name needs to be a string but got: {}".format(name))
~\anaconda3\envs\building_normalization\lib\site-packages\pymc3\model.py in Var(self, name, dist, data, total_size)
924 else:
925 with self:
--> 926 var = TransformedRV(name=name, distribution=dist,
927 transform=dist.transform,
928 total_size=total_size,
~\anaconda3\envs\building_normalization\lib\site-packages\pymc3\model.py in __init__(self, type, owner, index, name, distribution, model, transform, total_size)
1653 transformed_name = get_transformed_name(name, transform)
1654
-> 1655 self.transformed = model.Var(
1656 transformed_name, transform.apply(distribution), total_size=total_size)
1657
~\anaconda3\envs\building_normalization\lib\site-packages\pymc3\model.py in Var(self, name, dist, data, total_size)
919 if getattr(dist, "transform", None) is None:
920 with self:
--> 921 var = FreeRV(name=name, distribution=dist,
922 total_size=total_size, model=self)
923 self.free_RVs.append(var)
~\anaconda3\envs\building_normalization\lib\site-packages\pymc3\model.py in __init__(self, type, owner, index, name, distribution, total_size, model)
1368 self.tag.test_value = np.ones(
1369 distribution.shape, distribution.dtype) * distribution.default()
-> 1370 self.logp_elemwiset = distribution.logp(self)
1371 # The logp might need scaling in minibatches.
1372 # This is done in `Factor`.
~\anaconda3\envs\building_normalization\lib\site-packages\pymc3\distributions\transforms.py in logp(self, x)
166 if logp_nojac.ndim > jacobian_det.ndim:
167 logp_nojac = logp_nojac.sum(axis=-1)
--> 168 return logp_nojac + jacobian_det
169
170 def logp_nojac(self, x):
~\anaconda3\envs\building_normalization\lib\site-packages\theano\tensor\var.py in __add__(self, other)
126 def __add__(self, other):
127 try:
--> 128 return theano.tensor.basic.add(self, other)
129 # We should catch the minimum number of exception here.
130 # Otherwise this will convert error when Theano flags
~\anaconda3\envs\building_normalization\lib\site-packages\theano\gof\op.py in __call__(self, *inputs, **kwargs)
672 thunk.outputs = [storage_map[v] for v in node.outputs]
673
--> 674 required = thunk()
675 assert not required # We provided all inputs
676
~\anaconda3\envs\building_normalization\lib\site-packages\theano\gof\op.py in rval()
860
861 def rval():
--> 862 thunk()
863 for o in node.outputs:
864 compute_map[o][0] = True
~\anaconda3\envs\building_normalization\lib\site-packages\theano\gof\cc.py in __call__(self)
1737 print(self.error_storage, file=sys.stderr)
1738 raise
-> 1739 reraise(exc_type, exc_value, exc_trace)
1740
1741
~\anaconda3\envs\building_normalization\lib\site-packages\six.py in reraise(tp, value, tb)
701 if value.__traceback__ is not tb:
702 raise value.with_traceback(tb)
--> 703 raise value
704 finally:
705 value = None
ValueError: Input dimension mis-match. (input[0].shape[0] = 5, input[1].shape[0] = 20)