Reputation: 2243
I'm new to PyMC3 Here is some PyMC2 - do I need to do something specific like compile in Theano to convert this to PyMC3 code?
@pymc.deterministic
def away_theta(home_team=home_team,
away_team=away_team,
home=home,
atts=atts,
defs=defs,
intercept=intercept):
return np.exp(intercept +
atts[away_team] +
defs[home_team])
I get an error like
AsTensorError: ('Cannot convert home_theta to TensorType', <class 'pymc.PyMCObjects.Deterministic'>)
Upvotes: 2
Views: 1093
Reputation: 1316
Yes, determinstic transformations need to be theano expressions in pymc3. So instead of using np.exp you'd use theano.tensor.exp:
import theano.tensor as T
import pymc3 as pm
with Model():
...
regression = pm.Deterministic('regression', T.exp(intercept + atts[away_team] + defs[home_team]))
...
Upvotes: 3