Closed
Description
I get chain failure errors on two of the tests:
pymc3/tests/test_sampling.py::TestSamplePPC.test_deterministic_of_observed
and pymc3/tests/test_sampling.py::TestSamplePPC.test_deterministic_of_observed_modified_interface
I have destroyed my pymc3
virtual environment twice, and reinstalled first with 3.7.1 and second with 3.6.8, and I still get the problem.
Description of your problem
Please provide a minimal, self-contained, and reproducible example.
pytest pymc3/tests/test_sampling.py::TestSamplePPC::test_deterministic_of_observed
(alas, this is obviously not reproducible)
Please provide the full traceback.
pymc3.parallel_sampling.RemoteTraceback:
"""
Traceback (most recent call last):
File "/Users/rpg/src/pymc3/pymc3/parallel_sampling.py", line 128, in run
self._start_loop()
File "/Users/rpg/src/pymc3/pymc3/parallel_sampling.py", line 178, in _start_loop
point, stats = self._compute_point()
File "/Users/rpg/src/pymc3/pymc3/parallel_sampling.py", line 209, in _compute_point
point, stats = self._step_method.step(self._point)
File "/Users/rpg/src/pymc3/pymc3/step_methods/arraystep.py", line 263, in step
apoint, stats = self.astep(array)
File "/Users/rpg/src/pymc3/pymc3/step_methods/hmc/base_hmc.py", line 144, in astep
self.potential.raise_ok(self._logp_dlogp_func._ordering.vmap)
File "/Users/rpg/src/pymc3/pymc3/step_methods/hmc/quadpotential.py", line 255, in raise_ok
raise ValueError('\n'.join(errmsg))
ValueError: Mass matrix contains zeros on the diagonal.
The derivative of RV `sd__in_2_log__`.ravel()[0] is zero.
The derivative of RV `mu_in_2`.ravel()[0] is zero.
The derivative of RV `sd_in_1_log__`.ravel()[0] is zero.
The derivative of RV `mu_in_1`.ravel()[0] is zero.
"""
The above exception was the direct cause of the following exception:
pymc3.parallel_sampling.RemoteTraceback:
"""
Traceback (most recent call last):
File "/Users/rpg/src/pymc3/pymc3/parallel_sampling.py", line 128, in run
self._start_loop()
File "/Users/rpg/src/pymc3/pymc3/parallel_sampling.py", line 178, in _start_loop
point, stats = self._compute_point()
File "/Users/rpg/src/pymc3/pymc3/parallel_sampling.py", line 209, in _compute_point
point, stats = self._step_method.step(self._point)
File "/Users/rpg/src/pymc3/pymc3/step_methods/arraystep.py", line 263, in step
apoint, stats = self.astep(array)
File "/Users/rpg/src/pymc3/pymc3/step_methods/hmc/base_hmc.py", line 144, in astep
self.potential.raise_ok(self._logp_dlogp_func._ordering.vmap)
File "/Users/rpg/src/pymc3/pymc3/step_methods/hmc/quadpotential.py", line 255, in raise_ok
raise ValueError('\n'.join(errmsg))
ValueError: Mass matrix contains zeros on the diagonal.
The derivative of RV `sd__in_2_log__`.ravel()[0] is zero.
The derivative of RV `mu_in_2`.ravel()[0] is zero.
The derivative of RV `sd_in_1_log__`.ravel()[0] is zero.
The derivative of RV `mu_in_1`.ravel()[0] is zero.
"""
The above exception was the direct cause of the following exception:
ValueError: Mass matrix contains zeros on the diagonal.
The derivative of RV `sd__in_2_log__`.ravel()[0] is zero.
The derivative of RV `mu_in_2`.ravel()[0] is zero.
The derivative of RV `sd_in_1_log__`.ravel()[0] is zero.
The derivative of RV `mu_in_1`.ravel()[0] is zero.
The above exception was the direct cause of the following exception:
self = <pymc3.tests.test_sampling.TestSamplePPC object at 0x136a67cf8>
def test_deterministic_of_observed(self):
meas_in_1 = pm.theanof.floatX(2 + 4 * np.random.randn(100))
meas_in_2 = pm.theanof.floatX(5 + 4 * np.random.randn(100))
with pm.Model() as model:
mu_in_1 = pm.Normal("mu_in_1", 0, 1)
sigma_in_1 = pm.HalfNormal("sd_in_1", 1)
mu_in_2 = pm.Normal("mu_in_2", 0, 1)
sigma_in_2 = pm.HalfNormal("sd__in_2", 1)
in_1 = pm.Normal("in_1", mu_in_1, sigma_in_1, observed=meas_in_1)
in_2 = pm.Normal("in_2", mu_in_2, sigma_in_2, observed=meas_in_2)
out_diff = in_1 + in_2
pm.Deterministic("out", out_diff)
> trace = pm.sample(100)
pymc3/tests/test_sampling.py:424:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pymc3/sampling.py:493: in sample
trace = _mp_sample(**sample_args)
pymc3/sampling.py:1351: in _mp_sample
for draw in sampler:
pymc3/parallel_sampling.py:412: in __iter__
draw = ProcessAdapter.recv_draw(self._active)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
processes = [<pymc3.parallel_sampling.ProcessAdapter object at 0x1038060b8>], timeout = 3600
@staticmethod
def recv_draw(processes, timeout=3600):
if not processes:
raise ValueError("No processes.")
pipes = [proc._msg_pipe for proc in processes]
ready = multiprocessing.connection.wait(pipes)
if not ready:
raise multiprocessing.TimeoutError("No message from samplers.")
idxs = {id(proc._msg_pipe): proc for proc in processes}
proc = idxs[id(ready[0])]
msg = ready[0].recv()
if msg[0] == "error":
warns, old_error = msg[1:]
if warns is not None:
error = ParallelSamplingError(str(old_error), proc.chain, warns)
else:
error = RuntimeError("Chain %s failed." % proc.chain)
> raise error from old_error
E RuntimeError: Chain 2 failed.
pymc3/parallel_sampling.py:314: RuntimeError
---------------------------------------------------------------- Captured stdout call -----------------------------------------------------------------
█
---------------------------------------------------------------- Captured stderr call -----------------------------------------------------------------
Only 100 samples in chain.
Auto-assigning NUTS sampler...
Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (4 chains in 4 jobs)
NUTS: [sd__in_2, mu_in_2, sd_in_1, mu_in_1]
------------------------------------------------------------------ Captured log call ------------------------------------------------------------------
WARNING pymc3:sampling.py:427 Only 100 samples in chain.
INFO pymc3:sampling.py:437 Auto-assigning NUTS sampler...
INFO pymc3:sampling.py:1860 Initializing NUTS using jitter+adapt_diag...
INFO pymc3:sampling.py:490 Multiprocess sampling (4 chains in 4 jobs)
INFO pymc3:sampling.py:222 NUTS: [sd__in_2, mu_in_2, sd_in_1, mu_in_1]
============================================================ 1 failed in 61.19s (0:01:01) =============================================================
Please provide any additional information below.
Attaching output of pip freeze
from Python 3.6.8 virtual environment.
pip_freeze_.txt
Versions and main components
- PyMC3 Version: 48b8749
- Theano Version: 1.0.4
- Python Version: 3.6.8
- Operating system: MacOS 10.15.3
- How did you install PyMC3:
pip install -e