Ok, investigating that this might be an unexpected version bug, this is my current setup:
OS: Ubuntu 16.04.6 LTS
Python ver.: Python 3.6.6, Intel distribution
Numpy ver.: 1.16.3
Theano ver.: 1.0.4
Pymc3 ver.: 3.6
After forcibly upgrading python to 3.7 with conda install python==3.7
(so no more Intel distribution), and making sure I have the latest pymc by pip
installing it from master, and downgrading numpy
to ver. 1.15.0
, the error still appears.
I will post the whole bad energy error I see (first the original error, now the new one),
Python 3.6:
Auto-assigning NUTS sampler...
INFO:pymc3:Auto-assigning NUTS sampler...
Initializing NUTS using jitter+adapt_diag...
INFO:pymc3:Initializing NUTS using jitter+adapt_diag...
/home/furthermltesting/anaconda3/envs/idp/lib/python3.6/site-packages/theano/tensor/basic.py:6611: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
result[diagonal_slice] = x
/home/furthermltesting/anaconda3/envs/idp/lib/python3.6/site-packages/theano/tensor/basic.py:6611: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
result[diagonal_slice] = x
/home/furthermltesting/anaconda3/envs/idp/lib/python3.6/site-packages/theano/tensor/basic.py:6611: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
result[diagonal_slice] = x
/home/furthermltesting/anaconda3/envs/idp/lib/python3.6/site-packages/theano/tensor/basic.py:6611: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
result[diagonal_slice] = x
Sequential sampling (2 chains in 1 job)
INFO:pymc3:Sequential sampling (2 chains in 1 job)
NUTS: [σ, α, ℓ, η]
INFO:pymc3:NUTS: [σ, α, ℓ, η]
0%| | 0/2000 [00:00<?, ?it/s]/home/furthermltesting/anaconda3/envs/idp/lib/python3.6/site-packages/theano/tensor/basic.py:6611: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
result[diagonal_slice] = x
/home/furthermltesting/anaconda3/envs/idp/lib/python3.6/site-packages/theano/tensor/basic.py:6611: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
result[diagonal_slice] = x
---------------------------------------------------------------------------
SamplingError Traceback (most recent call last)
<ipython-input-9-4581e183b309> in <module>()
1 with model:
----> 2 tr = pm.sample(1000, tune=1000, chains=2, cores=1, nuts_kwargs={"target_accept":0.95})
3 # tr = pm.sample(n=10000, init='advi')
~/anaconda3/envs/idp/lib/python3.6/site-packages/pymc3/sampling.py in sample(draws, step, init, n_init, start, trace, chain_idx, chains, cores, tune, nuts_kwargs, step_kwargs, progressbar, model, random_seed, live_plot, discard_tuned_samples, live_plot_kwargs, compute_convergence_checks, use_mmap, **kwargs)
457 _log.info('Sequential sampling ({} chains in 1 job)'.format(chains))
458 _print_step_hierarchy(step)
--> 459 trace = _sample_many(**sample_args)
460
461 discard = tune if discard_tuned_samples else 0
~/anaconda3/envs/idp/lib/python3.6/site-packages/pymc3/sampling.py in _sample_many(draws, chain, chains, start, random_seed, step, **kwargs)
503 for i in range(chains):
504 trace = _sample(draws=draws, chain=chain + i, start=start[i],
--> 505 step=step, random_seed=random_seed[i], **kwargs)
506 if trace is None:
507 if len(traces) == 0:
~/anaconda3/envs/idp/lib/python3.6/site-packages/pymc3/sampling.py in _sample(chain, progressbar, random_seed, start, draws, step, trace, tune, model, live_plot, live_plot_kwargs, **kwargs)
547 try:
548 strace = None
--> 549 for it, strace in enumerate(sampling):
550 if live_plot:
551 if live_plot_kwargs is None:
~/anaconda3/envs/idp/lib/python3.6/site-packages/tqdm/_tqdm.py in __iter__(self)
1020 """), fp_write=getattr(self.fp, 'write', sys.stderr.write))
1021
-> 1022 for obj in iterable:
1023 yield obj
1024 # Update and possibly print the progressbar.
~/anaconda3/envs/idp/lib/python3.6/site-packages/pymc3/sampling.py in _iter_sample(draws, step, start, trace, chain, tune, model, random_seed)
643 step = stop_tuning(step)
644 if step.generates_stats:
--> 645 point, states = step.step(point)
646 if strace.supports_sampler_stats:
647 strace.record(point, states)
~/anaconda3/envs/idp/lib/python3.6/site-packages/pymc3/step_methods/arraystep.py in step(self, point)
245
246 if self.generates_stats:
--> 247 apoint, stats = self.astep(array)
248 point = self._logp_dlogp_func.array_to_full_dict(apoint)
249 return point, stats
~/anaconda3/envs/idp/lib/python3.6/site-packages/pymc3/step_methods/hmc/base_hmc.py in astep(self, q0)
147 )
148 self._warnings.append(warning)
--> 149 raise SamplingError("Bad initial energy")
150
151 adapt_step = self.tune and self.adapt_step_size
SamplingError: Bad initial energy
Python 3.7:
Auto-assigning NUTS sampler...
Initializing NUTS using jitter+adapt_diag...
/home/furthermltesting/anaconda3/envs/idp/lib/python3.7/site-packages/theano/tensor/basic.py:6611: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
result[diagonal_slice] = x
/home/furthermltesting/anaconda3/envs/idp/lib/python3.7/site-packages/theano/tensor/basic.py:6611: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
result[diagonal_slice] = x
Sequential sampling (2 chains in 1 job)
NUTS: [σ, t_diff, α, ℓ, η]
0%| | 0/2000 [00:00<?, ?it/s]/home/furthermltesting/anaconda3/envs/idp/lib/python3.7/site-packages/theano/tensor/basic.py:6611: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
result[diagonal_slice] = x
---------------------------------------------------------------------------
SamplingError Traceback (most recent call last)
<ipython-input-10-4581e183b309> in <module>
1 with model:
----> 2 tr = pm.sample(1000, tune=1000, chains=2, cores=1, nuts_kwargs={"target_accept":0.95})
3 # tr = pm.sample(n=10000, init='advi')
~/anaconda3/envs/idp/lib/python3.7/site-packages/pymc3/sampling.py in sample(draws, step, init, n_init, start, trace, chain_idx, chains, cores, tune, progressbar, model, random_seed, discard_tuned_samples, compute_convergence_checks, **kwargs)
450 _log.info('Sequential sampling ({} chains in 1 job)'.format(chains))
451 _print_step_hierarchy(step)
--> 452 trace = _sample_many(**sample_args)
453
454 discard = tune if discard_tuned_samples else 0
~/anaconda3/envs/idp/lib/python3.7/site-packages/pymc3/sampling.py in _sample_many(draws, chain, chains, start, random_seed, step, **kwargs)
496 for i in range(chains):
497 trace = _sample(draws=draws, chain=chain + i, start=start[i],
--> 498 step=step, random_seed=random_seed[i], **kwargs)
499 if trace is None:
500 if len(traces) == 0:
~/anaconda3/envs/idp/lib/python3.7/site-packages/pymc3/sampling.py in _sample(chain, progressbar, random_seed, start, draws, step, trace, tune, model, **kwargs)
538 try:
539 strace = None
--> 540 for it, strace in enumerate(sampling):
541 if it >= skip_first:
542 trace = MultiTrace([strace])
~/anaconda3/envs/idp/lib/python3.7/site-packages/tqdm/_tqdm.py in __iter__(self)
1020 """), fp_write=getattr(self.fp, 'write', sys.stderr.write))
1021
-> 1022 for obj in iterable:
1023 yield obj
1024 # Update and possibly print the progressbar.
~/anaconda3/envs/idp/lib/python3.7/site-packages/pymc3/sampling.py in _iter_sample(draws, step, start, trace, chain, tune, model, random_seed)
627 step = stop_tuning(step)
628 if step.generates_stats:
--> 629 point, states = step.step(point)
630 if strace.supports_sampler_stats:
631 strace.record(point, states)
~/anaconda3/envs/idp/lib/python3.7/site-packages/pymc3/step_methods/arraystep.py in step(self, point)
245
246 if self.generates_stats:
--> 247 apoint, stats = self.astep(array)
248 point = self._logp_dlogp_func.array_to_full_dict(apoint)
249 return point, stats
~/anaconda3/envs/idp/lib/python3.7/site-packages/pymc3/step_methods/hmc/base_hmc.py in astep(self, q0)
142 )
143 self._warnings.append(warning)
--> 144 raise SamplingError("Bad initial energy")
145
146 adapt_step = self.tune and self.adapt_step_size
SamplingError: Bad initial energy
What could possibly be going on here?