Hello all,
Thank you in advance for any advice on how i might get around using this external function within pymc3
There’s a few other external functions that i need to implement within this model, but hopefully if i can figure this one out, the other ones will be easier to solve!
import numpy as np
import aesara.tensor as aet
from aesara import function
import aesara
import pymc3 as pm
aesara.config.compute_test_value = 'off'
###############################################################
om = aet.dscalar('om')
x_ = aet.vector('x_')
v_ = aet.vector('v_')
J_ = (om**2 * x_**2 + v_**2)/(om*2*np.pi)
J = function([x_,v_,om], J_)
with pm.Model() as model:
omega = pm.Uniform('omega',lower=.5,upper =3)
#calculate stuff!
y = J(x_data,y_data,omega)
Error:
Bad input argument with name "omega" to aesara function with name "/var/folders/6r/zp_njhxn2hd0dbbm3gcbgpdw0000gn/T/ipykernel_74629/2510932872.py:8" at index 2 (0-based).
Backtrace when that variable is created:
File "/Users/juan/anaconda3/envs/project12/lib/python3.8/site-packages/ipykernel/zmqshell.py", line 533, in run_cell
return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
File "/Users/juan/anaconda3/envs/project12/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 2901, in run_cell
result = self._run_cell(
File "/Users/juan/anaconda3/envs/project12/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 2947, in _run_cell
return runner(coro)
File "/Users/juan/anaconda3/envs/project12/lib/python3.8/site-packages/IPython/core/async_helpers.py", line 68, in _pseudo_sync_runner
coro.send(None)
File "/Users/juan/anaconda3/envs/project12/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3172, in run_cell_async
has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
File "/Users/juan/anaconda3/envs/project12/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3364, in run_ast_nodes
if (await self.run_code(code, result, async_=asy)):
File "/Users/juan/anaconda3/envs/project12/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3444, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "/var/folders/6r/zp_njhxn2hd0dbbm3gcbgpdw0000gn/T/ipykernel_74629/2510932872.py", line 2, in <module>
om = aet.dscalar('om')
setting an array element with a sequence.