I am trying to move our hierarchal model to v4 and getting errors I cannot parse with the NoDistribution class.
This is the code that worked in v3:
with pm.Model() as model:
# Distance distribution
P = pm.NoDistribution('P', shape=len(r), dtype='float64', testval=np.zeros(len(r))) # no prior (it's included in the Gibbs sampler)
This is how I have updated the code according to the initial errors and changes with v4.
with pm.Model() as model:
# Distance distribution
P = pm.NoDistribution.dist(dist_params=[], shape=len(r), dtype='float64') # no prior (it's included in the Gibbs sampler)
This is the error I’m getting:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/var/folders/wc/_3x4n2y53c170w0byjj87tm00000gn/T/ipykernel_29974/1527883537.py in <module>
1 pars = {"method": 'regularization', "r": np.linspace(2,6,50)}
2
----> 3 model_tikh = dive.model(t, Vexp, pars)
4
5 MCMCparameters = {"draws": 2000,"tune": 500, "chains": 4, "cores": 4}
~/Documents/GitHub/Bayes/dive/dive/models.py in model(t, Vexp, pars)
62 tauGibbs = method == "regularization"
63 deltaGibbs = method == "regularization"
---> 64 model_pymc = regularizationmodel(t, Vexp, K0, r, delta_prior=delta_prior, tau_prior=tau_prior, tauGibbs=tauGibbs, deltaGibbs=deltaGibbs)
65
66 model_pars = {"r": r, "K0": K0, "L": L, "LtL": LtL, "K0tK0": K0tK0, "delta_prior": delta_prior, "tau_prior": tau_prior}
~/Documents/GitHub/Bayes/dive/dive/models.py in regularizationmodel(t, Vdata, K0, r, delta_prior, tau_prior, includeBackground, includeModDepth, includeAmplitude, tauGibbs, deltaGibbs)
163 with pm.Model() as model:
164 # Distance distribution
--> 165 P = pm.NoDistribution.dist(dist_params=[], shape=len(r), dtype='float64') # no prior (it's included in the Gibbs sampler)
166
167 # Time-domain model signal
~/opt/anaconda3/envs/Python38/lib/python3.9/site-packages/pymc/distributions/distribution.py in dist(cls, dist_params, shape, size, **kwargs)
347
...
--> 349 shape=shape, size=size, ndim_supp=cls.rv_op.ndim_supp
350 )
351 # Create the RV with a `size` right away.
AttributeError: 'NoneType' object has no attribute 'ndim_supp'
Any advice would be really appreciated. Thank you!