Hi everyone,
I am having some trouble running SMC-ABC in PyMC v4. I have followed the topic Does PyMC work for ABC SMC? and, as suggested, decided to open a new topic for this.
I have not found any example for SMC-ABC for the new release, but after reading the documentation on pymc.Simulator, I expected to be able to run at least the example there.
When I run the example on the Simulator
doc, I get the following message:
Running on PyMC v4.0.0b6
Initializing SMC sampler...
Sampling 4 chains in 4 jobs
multiprocessing.pool.RemoteTraceback: ----------------------------------------------------------------| 0.00% [0/100 00:00<00:00 Stage: 0 Beta: 0]
"""
Traceback (most recent call last):
File "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 51, in starmapstar
return list(itertools.starmap(args[0], args[1]))
File "/usr/local/lib/python3.9/site-packages/pymc/smc/sample_smc.py", line 439, in _apply_args_and_kwargs
return fn(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/pymc/smc/sample_smc.py", line 363, in _sample_smc_int
smc._initialize_kernel()
File "/usr/local/lib/python3.9/site-packages/pymc/smc/smc.py", line 217, in _initialize_kernel
initial_point, [self.model.datalogpt], self.variables, shared
File "/usr/local/lib/python3.9/site-packages/pymc/model.py", line 865, in datalogpt
return self.observedlogpt + self.potentiallogpt
File "/usr/local/lib/python3.9/site-packages/pymc/model.py", line 882, in observedlogpt
return self.logpt(vars=self.observed_RVs)
File "/usr/local/lib/python3.9/site-packages/pymc/model.py", line 763, in logpt
rv_logps = joint_logpt(list(rv_values.keys()), rv_values, sum=False, jacobian=jacobian)
File "/usr/local/lib/python3.9/site-packages/pymc/distributions/logprob.py", line 224, in joint_logpt
temp_logp_var_dict = factorized_joint_logprob(
File "/usr/local/lib/python3.9/site-packages/aeppl-0.0.28-py3.9.egg/aeppl/joint_logprob.py", line 186, in factorized_joint_logprob
q_logprob_vars = _logprob(
File "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/functools.py", line 888, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/usr/local/lib/python3.9/site-packages/aeppl-0.0.28-py3.9.egg/aeppl/logprob.py", line 85, in _logprob
raise NotImplementedError(f"Logprob method not implemented for {op}")
NotImplementedError: Logprob method not implemented for Simulator_rv{0, (0, 0), floatX, False}
"""
So I decided to run pytest test_smc.py
and got 5 failures:
FAILED test_smc.py::TestSimulator::test_custom_dist_sum_stat[float32] - NotImplementedError: Logprob method not implemented for Simulator_rv{0, (0, 0), floatX, False}
FAILED test_smc.py::TestSimulator::test_custom_dist_sum_stat[float64] - NotImplementedError: Logprob method not implemented for Simulator_rv{0, (0, 0), floatX, False}
FAILED test_smc.py::TestSimulator::test_multiple_simulators - NotImplementedError: Logprob method not implemented for Simulator_rv{0, (0, 0), floatX, False}
FAILED test_smc.py::TestSimulator::test_nested_simulators - NotImplementedError: Logprob method not implemented for Simulator_rv{0, (0, 0), floatX, False}
FAILED test_smc.py::TestSimulator::test_named_model - NotImplementedError: Logprob method not implemented for Simulator_rv{0, (0, 0), floatX, False}
I have installed PyMC v4 using the instructions on github for MacOS, so I would expect everything to be running smoothly.
Did I miss something in the install/config or am I doing sth wrong here?
Thanks!