These two lines of my model construction code:
# prior_means[I] = prior mean(output(I))
prior_means = shared(np.where(np.array(self.outputs()),
prior_dict['prior means'][1],
prior_dict['prior means'][0]))
means = TruncatedNormal("%s Output"%gate,
mu=prior_means, sd=3.0, lower=0.0,
upper=MAX_GFP, shape=num_inputs)
…cause PyMC3 to error out with the following error:
File "/Users/rpg/src/pymc3/pymc3/theanof.py", line 65, in floatX
return X.astype(theano.config.floatX)
AttributeError: 'SharedVariable' object has no attribute 'astype'
This is also printed:
ValueError: setting an array element with a sequence.
The traceback:
Traceback (most recent call last):
File "/Users/rpg/src/pymc3/pymc3/theanof.py", line 65, in floatX
return X.astype(theano.config.floatX)
AttributeError: 'SharedVariable' object has no attribute 'astype'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/rpg/projects/xplan/xplan-experiment-analysis/src/xplan_experiment_analysis/continuous_models.py", line 341, in __init__
parent=self)
File "/Users/rpg/projects/xplan/xplan-experiment-analysis/src/xplan_experiment_analysis/continuous_models.py", line 156, in __init__
upper=MAX_GFP, shape=num_inputs)
File "/Users/rpg/projects/xplan/xplan-experiment-analysis/src/xplan_experiment_analysis/continuous_models.py", line 129, in TruncatedNormal
return pm.TruncatedNormal(self.prefixed_name(name), *args, **kwargs)
File "/Users/rpg/src/pymc3/pymc3/distributions/distribution.py", line 46, in __new__
dist = cls.dist(*args, **kwargs)
File "/Users/rpg/src/pymc3/pymc3/distributions/distribution.py", line 57, in dist
dist.__init__(*args, **kwargs)
File "/Users/rpg/src/pymc3/pymc3/distributions/continuous.py", line 633, in __init__
self.mu = tt.as_tensor_variable(floatX(mu))
File "/Users/rpg/src/pymc3/pymc3/theanof.py", line 68, in floatX
return np.asarray(X, dtype=theano.config.floatX)
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/numeric.py", line 538, in asarray
return array(a, dtype, copy=False, order=order)
ValueError: setting an array element with a sequence.
Thanks for any suggestions.