While trying to do 1d convolution in pymc3 (see thread) i tried to use signal.convolve from scipy. If signal.convolve is used with just the data and a function as input we get an error because the volume and kernel should have the same dimensionality, but if we define the data as a shared variable we are able to sample.
from scipy import signal
from theano import shared
xtest=np.linspace(0,10,100) filt=2.0*xtest conv=signal.convolve(xtest, filt, mode='same') with pm.Model() as model: xtestS = shared(xtest) A = pm.Normal('A', mu=2.0, sigma=1.0) filtt = A*xtestS convol=signal.convolve(xtestS, filtt, mode='same') likelihood = pm.Normal('conv', mu=convol, observed=conv) trace = pm.sample(1000)
But the sampling of the parameter A is way off
I am curious if anyone has any idea about what is going on here. My initial guess would be that scipy convolution does not understand the structure of the shared(data) and only does the convolution for one element of the array or something to that effect.