Hi,
I’m not sure if this question is better suited for discourse or the github repo, so I’m starting here.
I am installing the latest development version of pymc3 on my linux cluster and running the automated tests to verify I have everything running correctly. All the tests are passing except for one.
In test_step.py::TestNutsCheckTrace::()::test_bad_init
I am getting a RuntimeError
when the test is expecting a ValueError
. I think the ValueError
is being wrapped by the RuntimeError
. I see that the latest build is passing this test, so I am assuming its an issue with my specific installation.
Would someone be able to provide some direction to how I might get this test to pass? Has anyone else seen this issue? Should I post this to the github repo instead of here?
Thanks in advance for your help!
Best regards,
Jeff
Running the test:
py.test pymc3/tests/test_step.py::TestNutsCheckTrace
Test traceback:
_____________________________________________________________________________________________________ TestNutsCheckTrace.test_bad_init ______________________________________________________________________________________________________
pymc3.parallel_sampling.RemoteTraceback:
"""
Traceback (most recent call last):
File "/home/jdoak/src/pymc3/pymc3/parallel_sampling.py", line 73, in run
self._start_loop()
File "/home/jdoak/src/pymc3/pymc3/parallel_sampling.py", line 113, in _start_loop
point, stats = self._compute_point()
File "/home/jdoak/src/pymc3/pymc3/parallel_sampling.py", line 139, in _compute_point
point, stats = self._step_method.step(self._point)
File "/home/jdoak/src/pymc3/pymc3/step_methods/arraystep.py", line 247, in step
apoint, stats = self.astep(array)
File "/home/jdoak/src/pymc3/pymc3/step_methods/hmc/base_hmc.py", line 117, in astep
'might be misspecified.' % start.energy)
ValueError: Bad initial energy: inf. The model might be misspecified.
"""
The above exception was the direct cause of the following exception:
pymc3.parallel_sampling.RemoteTraceback:
"""
Traceback (most recent call last):
File "/home/jdoak/src/pymc3/pymc3/parallel_sampling.py", line 73, in run
self._start_loop()
File "/home/jdoak/src/pymc3/pymc3/parallel_sampling.py", line 113, in _start_loop
point, stats = self._compute_point()
File "/home/jdoak/src/pymc3/pymc3/parallel_sampling.py", line 139, in _compute_point
point, stats = self._step_method.step(self._point)
File "/home/jdoak/src/pymc3/pymc3/step_methods/arraystep.py", line 247, in step
apoint, stats = self.astep(array)
File "/home/jdoak/src/pymc3/pymc3/step_methods/hmc/base_hmc.py", line 117, in astep
'might be misspecified.' % start.energy)
ValueError: Bad initial energy: inf. The model might be misspecified.
"""
The above exception was the direct cause of the following exception:
ValueError: Bad initial energy: inf. The model might be misspecified.
The above exception was the direct cause of the following exception:
self = <pymc3.tests.test_step.TestNutsCheckTrace object at 0x7f895a6748d0>
def test_bad_init(self):
with Model():
HalfNormal('a', sd=1, testval=-1, transform=None)
with pytest.raises(ValueError) as error:
> sample(init=None)
pymc3/tests/test_step.py:431:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pymc3/sampling.py:440: in sample
trace = _mp_sample(**sample_args)
pymc3/sampling.py:990: in _mp_sample
for draw in sampler:
pymc3/parallel_sampling.py:305: in __iter__
draw = ProcessAdapter.recv_draw(self._active)
pymc3/parallel_sampling.py:223: in recv_draw
six.raise_from(RuntimeError('Chain %s failed.' % proc.chain), old)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value = None, from_value = ValueError('Bad initial energy: inf. The model might be misspecified.',)
> ???
E RuntimeError: Chain 0 failed.
<string>:3: RuntimeError
System Info:
- PyMC3 Version: https://github.com/pymc-devs/pymc3
- Theano Version: 1.0.2
- Python Version: 3.6.5
- Operating system: CentOS 7
- How did you install PyMC3: (pip install -e)