-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
This is a tangent from issue #2094 - I updated my versions of pymc3 and theano while testing out the model I mentioned in that issue. I am currently running:
In [17]: theano.__version__
Out[17]: '0.9.0.dev-c697eeab84e5b8a74908da654b66ec9eca4f1291'
In [18]: pm.__version__
Out[18]: '3.1rc3'
Here's the model again (same as in #2094 ):
with pm.Model() as model:
# Dirichlet prior on the emission/spiking probabilities - 7 states (1 start state, 2 from changepoint1 to changepoint2, 4 from changepoint2 to end of the trial)
p = pm.Dirichlet('p', np.ones(17), shape = (7, 17))
# Uniform switch times
# First changepoint
t1 = pm.Uniform('t1', lower = 20, upper = 60, shape = 32)
# Second changepoint
t2 = pm.Uniform('t2', lower = t1 + 20, upper = 130, shape = 32)
# Get the actual state numbers based on the switch times
states1 = tt.switch(t1 >= np.repeat(np.arange(150)[:, None], 32, axis = 1), 0, set1[:])
states2 = tt.switch(t2 >= np.repeat(np.arange(150)[:, None], 32, axis = 1), states1, set2[:])
# Define the log-likelihood function
def logp(value):
value = tt.cast(value, 'int32')
loglik = tt.sum(tt.log(p[states2.T, value]))
return loglik
# Categorical observations
obs = pm.DensityDist('obs', logp, observed = {'value': data[:, :150]})
# Inference button
tr = pm.sample(500000, init = None, step = pm.Metropolis(), njobs = 2, start = {'t1': 25.0, 't2': 120.0})
The model runs fine if I don't specify the start argument in pm.sample. However, if I specify the start argument, Theano throws this error (this model was working with the older versions of pymc3 and theano that I had previously):
In [34]: with model:
...: tr = pm.sample(500000, init = None, step = pm.Metropolis(), njobs =
...: 2, start = {'t1': 25.0, 't2': 120.0})
...:
0%| | 0/500000 [00:00<?, ?it/s]
---------------------------------------------------------------------------
RemoteTraceback Traceback (most recent call last)
RemoteTraceback:
"""
Details
Traceback (most recent call last):
File "/home/narendra/anaconda3/lib/python3.6/site-packages/joblib/_parallel_backends.py", line 344, in __call__
return self.func(*args, **kwargs)
File "/home/narendra/anaconda3/lib/python3.6/site-packages/joblib/parallel.py", line 131, in __call__
return [func(*args, **kwargs) for func, args, kwargs in self.items]
File "/home/narendra/anaconda3/lib/python3.6/site-packages/joblib/parallel.py", line 131, in <listcomp>
return [func(*args, **kwargs) for func, args, kwargs in self.items]
File "/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py", line 274, in _sample
for it, strace in enumerate(sampling):
File "/home/narendra/anaconda3/lib/python3.6/site-packages/tqdm/_tqdm.py", line 833, in __iter__
for obj in iterable:
File "/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py", line 351, in _iter_sample
_update_start_vals(start, model.test_point, model)
File "/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py", line 467, in _update_start_vals
b[tname] = transform_func[0].forward(a[name]).eval()
File "/home/narendra/anaconda3/lib/python3.6/site-packages/theano/gof/graph.py", line 516, in eval
self._fn_cache[inputs] = theano.function(inputs, self)
File "/home/narendra/anaconda3/lib/python3.6/site-packages/theano/compile/function.py", line 326, in function
output_keys=output_keys)
File "/home/narendra/anaconda3/lib/python3.6/site-packages/theano/compile/pfunc.py", line 486, in pfunc
output_keys=output_keys)
File "/home/narendra/anaconda3/lib/python3.6/site-packages/theano/compile/function_module.py", line 1794, in orig_function
output_keys=output_keys).create(
File "/home/narendra/anaconda3/lib/python3.6/site-packages/theano/compile/function_module.py", line 1446, in __init__
accept_inplace)
File "/home/narendra/anaconda3/lib/python3.6/site-packages/theano/compile/function_module.py", line 177, in std_fgraph
update_mapping=update_mapping)
File "/home/narendra/anaconda3/lib/python3.6/site-packages/theano/gof/fg.py", line 180, in __init__
self.__import_r__(output, reason="init")
File "/home/narendra/anaconda3/lib/python3.6/site-packages/theano/gof/fg.py", line 351, in __import_r__
self.__import__(variable.owner, reason=reason)
File "/home/narendra/anaconda3/lib/python3.6/site-packages/theano/gof/fg.py", line 397, in __import__
raise MissingInputError(error_msg, variable=r)
theano.gof.fg.MissingInputError: Input 0 of the graph (indices start from 0), used to compute sigmoid(t1_interval__), was not provided and not given a value. Use the Theano flag exception_verbosity='high', for more information on this error.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/narendra/anaconda3/lib/python3.6/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/home/narendra/anaconda3/lib/python3.6/site-packages/joblib/_parallel_backends.py", line 353, in __call__
raise TransportableException(text, e_type)
joblib.my_exceptions.TransportableException: TransportableException
___________________________________________________________________________
MissingInputError Tue May 2 13:25:22 2017
PID: 26681 Python 3.6.0: /home/narendra/anaconda3/bin/python
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/joblib/parallel.py in __call__(self=<joblib.parallel.BatchedCalls object>)
126 def __init__(self, iterator_slice):
127 self.items = list(iterator_slice)
128 self._size = len(self.items)
129
130 def __call__(self):
--> 131 return [func(*args, **kwargs) for func, args, kwargs in self.items]
self.items = [(<function _sample>, (), {'chain': 0, 'draws': 500000, 'live_plot': False, 'model': <pymc3.model.Model object>, 'progressbar': True, 'random_seed': 442901656, 'start': {'t1': 25.0, 't2': 120.0}, 'step': <pymc3.step_methods.compound.CompoundStep object>, 'trace': None, 'tune': None})]
132
133 def __len__(self):
134 return self._size
135
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/joblib/parallel.py in <listcomp>(.0=<list_iterator object>)
126 def __init__(self, iterator_slice):
127 self.items = list(iterator_slice)
128 self._size = len(self.items)
129
130 def __call__(self):
--> 131 return [func(*args, **kwargs) for func, args, kwargs in self.items]
func = <function _sample>
args = ()
kwargs = {'chain': 0, 'draws': 500000, 'live_plot': False, 'model': <pymc3.model.Model object>, 'progressbar': True, 'random_seed': 442901656, 'start': {'t1': 25.0, 't2': 120.0}, 'step': <pymc3.step_methods.compound.CompoundStep object>, 'trace': None, 'tune': None}
132
133 def __len__(self):
134 return self._size
135
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py in _sample(draws=500000, step=<pymc3.step_methods.compound.CompoundStep object>, start={'t1': 25.0, 't2': 120.0}, trace=None, chain=0, tune=None, progressbar=True, model=<pymc3.model.Model object>, random_seed=442901656, live_plot=False, **kwargs={})
269 tune, model, random_seed)
270 if progressbar:
271 sampling = tqdm(sampling, total=draws)
272 try:
273 strace = None
--> 274 for it, strace in enumerate(sampling):
it = undefined
strace = None
sampling = 0%| | 0/500000 [00:00<?, ?it/s]
275 if live_plot:
276 if it >= skip_first:
277 trace = MultiTrace([strace])
278 if it == skip_first:
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/tqdm/_tqdm.py in __iter__(self= 0%| | 0/500000 [00:00<?, ?it/s])
828 except AttributeError:
829 raise TqdmDeprecationWarning("""\
830 Please use `tqdm_gui(...)` instead of `tqdm(..., gui=True)`
831 """, fp_write=getattr(self.fp, 'write', sys.stderr.write))
832
--> 833 for obj in iterable:
obj = undefined
iterable = <generator object _iter_sample>
834 yield obj
835 # Update and print the progressbar.
836 # Note: does not call self.update(1) for speed optimisation.
837 n += 1
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py in _iter_sample(draws=500000, step=<pymc3.step_methods.compound.CompoundStep object>, start={'t1': 25.0, 't2': 120.0}, trace=None, chain=0, tune=None, model=<pymc3.model.Model object>, random_seed=442901656)
346 strace = _choose_backend(trace, chain, model=model)
347
348 if len(strace) > 0:
349 _update_start_vals(start, strace.point(-1), model)
350 else:
--> 351 _update_start_vals(start, model.test_point, model)
start = {'t1': 25.0, 't2': 120.0}
model.test_point = {'p_stickbreaking__': array([[ 0.00000000e+00, 0.00000000e+00, 0....00, 3.33066907e-16,
0.00000000e+00]]), 't1_interval__': array([ 0., 0., 0., 0., 0., 0., 0., 0., ..., 0., 0.,
0., 0., 0., 0., 0., 0.]), 't2_interval__': array([ 0., 0., 0., 0., 0., 0., 0., 0., ..., 0., 0.,
0., 0., 0., 0., 0., 0.])}
model = <pymc3.model.Model object>
352
353 try:
354 step = CompoundStep(step)
355 except TypeError:
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py in _update_start_vals(a={'t1': 25.0, 't2': 120.0}, b={'p_stickbreaking__': array([[ 0.00000000e+00, 0.00000000e+00, 0....00, 3.33066907e-16,
0.00000000e+00]]), 't1_interval__': array(-1.9459102153778076, dtype=float32), 't2_interval__': array([ 0., 0., 0., 0., 0., 0., 0., 0., ..., 0., 0.,
0., 0., 0., 0., 0., 0.])}, model=<pymc3.model.Model object>)
462 for name in a:
463 for tname in b:
464 if is_transformed_name(tname) and get_untransformed_name(tname) == name:
465 transform_func = [d.transformation for d in model.deterministics if d.name == name]
466 if transform_func:
--> 467 b[tname] = transform_func[0].forward(a[name]).eval()
b = {'p_stickbreaking__': array([[ 0.00000000e+00, 0.00000000e+00, 0....00, 3.33066907e-16,
0.00000000e+00]]), 't1_interval__': array(-1.9459102153778076, dtype=float32), 't2_interval__': array([ 0., 0., 0., 0., 0., 0., 0., 0., ..., 0., 0.,
0., 0., 0., 0., 0., 0.])}
tname = 't2_interval__'
transform_func.forward = undefined
a = {'t1': 25.0, 't2': 120.0}
468
469 a.update({k: v for k, v in b.items() if k not in a})
470
471 def sample_ppc(trace, samples=None, model=None, vars=None, size=None,
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/gof/graph.py in eval(self=Elemwise{sub,no_inplace}.0, inputs_to_values={})
511 if not hasattr(self, '_fn_cache'):
512 self._fn_cache = dict()
513
514 inputs = tuple(sorted(inputs_to_values.keys(), key=id))
515 if inputs not in self._fn_cache:
--> 516 self._fn_cache[inputs] = theano.function(inputs, self)
self._fn_cache = {}
inputs = ()
self = Elemwise{sub,no_inplace}.0
517 args = [inputs_to_values[param] for param in inputs]
518
519 rval = self._fn_cache[inputs](*args)
520
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/compile/function.py in function(inputs=(), outputs=Elemwise{sub,no_inplace}.0, mode=None, updates=[], givens=[], no_default_updates=False, accept_inplace=False, name='/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py:467', rebuild_strict=True, allow_input_downcast=None, profile=None, on_unused_input=None)
321 accept_inplace=accept_inplace, name=name,
322 rebuild_strict=rebuild_strict,
323 allow_input_downcast=allow_input_downcast,
324 on_unused_input=on_unused_input,
325 profile=profile,
--> 326 output_keys=output_keys)
output_keys = None
327 # We need to add the flag check_aliased inputs if we have any mutable or
328 # borrowed used defined inputs
329 fn._check_for_aliased_inputs = check_for_aliased_inputs
330 return fn
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/compile/pfunc.py in pfunc(params=(), outputs=Elemwise{sub,no_inplace}.0, mode=None, updates=[], givens=[], no_default_updates=False, accept_inplace=False, name='/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py:467', rebuild_strict=True, allow_input_downcast=None, profile=None, on_unused_input=None, output_keys=None)
481 inputs.append(si)
482
483 return orig_function(inputs, cloned_outputs, mode,
484 accept_inplace=accept_inplace, name=name,
485 profile=profile, on_unused_input=on_unused_input,
--> 486 output_keys=output_keys)
output_keys = None
487
488
489 def _pfunc_param_to_in(param, strict=False, allow_downcast=None):
490 if isinstance(param, Constant):
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/compile/function_module.py in orig_function(inputs=[], outputs=Out(Elemwise{sub,no_inplace}.0,False), mode=<theano.compile.mode.Mode object>, accept_inplace=False, name='/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py:467', profile=None, on_unused_input=None, output_keys=None)
1789 outputs,
1790 mode,
1791 accept_inplace=accept_inplace,
1792 profile=profile,
1793 on_unused_input=on_unused_input,
-> 1794 output_keys=output_keys).create(
output_keys = None
output_keys.create = undefined
1795 defaults)
1796
1797 t2 = time.time()
1798 if profile:
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/compile/function_module.py in __init__(self=<theano.compile.function_module.FunctionMaker object>, inputs=[], outputs=[Out(Elemwise{sub,no_inplace}.0,False)], mode=<theano.compile.mode.Mode object>, accept_inplace=False, function_builder=<class 'theano.compile.function_module.Function'>, profile=None, on_unused_input=None, fgraph=None, output_keys=None)
1441 if fgraph is None:
1442 need_opt = True
1443 # make the fgraph (copies the graph, creates NEW INPUT AND
1444 # OUTPUT VARIABLES)
1445 fgraph, additional_outputs = std_fgraph(inputs, outputs,
-> 1446 accept_inplace)
accept_inplace = False
1447 fgraph.profile = profile
1448 else:
1449 # fgraph is already an optimized one
1450 need_opt = False
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/compile/function_module.py in std_fgraph(input_specs=[], output_specs=[Out(Elemwise{sub,no_inplace}.0,False)], accept_inplace=False)
172 out_idx += 1
173
174 orig_outputs = [spec.variable for spec in output_specs] + updates
175
176 fgraph = gof.fg.FunctionGraph(orig_inputs, orig_outputs,
--> 177 update_mapping=update_mapping)
update_mapping = {}
178
179 for node in fgraph.apply_nodes:
180 if getattr(node.op, 'destroy_map', None):
181 if not accept_inplace:
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/gof/fg.py in __init__(self=[Elemwise{sub,no_inplace}(Elemwise{log,no_inplac...}(TensorConstant{130}, TensorConstant{120.0}))))], inputs=[], outputs=[Elemwise{sub,no_inplace}.0], features=[], clone=True, update_mapping={})
175 "input's owner or use graph.clone.")
176 self.__setup_r__(input)
177 self.variables.add(input)
178
179 for output in outputs:
--> 180 self.__import_r__(output, reason="init")
self.__import_r__ = <bound method FunctionGraph.__import_r__ of [Ele...(TensorConstant{130}, TensorConstant{120.0}))))]>
output = Elemwise{sub,no_inplace}.0
181 for i, output in enumerate(outputs):
182 output.clients.append(('output', i))
183
184 self.profile = None
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/gof/fg.py in __import_r__(self=[Elemwise{sub,no_inplace}(Elemwise{log,no_inplac...}(TensorConstant{130}, TensorConstant{120.0}))))], variable=Elemwise{sub,no_inplace}.0, reason='init')
346 reason
347 reason is the name of the optimization or operation in progress.
348 """
349 # Imports the owners of the variables
350 if variable.owner and variable.owner not in self.apply_nodes:
--> 351 self.__import__(variable.owner, reason=reason)
self.__import__ = <bound method FunctionGraph.__import__ of [Elemw...(TensorConstant{130}, TensorConstant{120.0}))))]>
variable.owner = Elemwise{sub,no_inplace}(Elemwise{log,no_inplace}.0, InplaceDimShuffle{x}.0)
reason = 'init'
352 elif (variable.owner is None and
353 not isinstance(variable, graph.Constant) and
354 variable not in self.inputs):
355 global NullType
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/gof/fg.py in __import__(self=[Elemwise{sub,no_inplace}(Elemwise{log,no_inplac...}(TensorConstant{130}, TensorConstant{120.0}))))], apply_node=Elemwise{sub,no_inplace}(Elemwise{log,no_inplace}.0, InplaceDimShuffle{x}.0), check=True, reason='init')
392 "provided and not given a value. Use the "
393 "Theano flag exception_verbosity='high', "
394 "for more information on this error."
395 % (node.inputs.index(r), str(node)))
396 error_msg += get_variable_trace_string(r)
--> 397 raise MissingInputError(error_msg, variable=r)
error_msg = "Input 0 of the graph (indices start from 0), use...osity='high', for more information on this error."
r = t1_interval__
398
399 for node in new_nodes:
400 assert node not in self.apply_nodes
401 self.__setup_node__(node)
MissingInputError: Input 0 of the graph (indices start from 0), used to compute sigmoid(t1_interval__), was not provided and not given a value. Use the Theano flag exception_verbosity='high', for more information on this error.
___________________________________________________________________________
"""
The above exception was the direct cause of the following exception:
TransportableException Traceback (most recent call last)
/home/narendra/anaconda3/lib/python3.6/site-packages/joblib/parallel.py in retrieve(self)
681 if 'timeout' in getfullargspec(job.get).args:
--> 682 self._output.extend(job.get(timeout=self.timeout))
683 else:
/home/narendra/anaconda3/lib/python3.6/multiprocessing/pool.py in get(self, timeout)
607 else:
--> 608 raise self._value
609
TransportableException: TransportableException
___________________________________________________________________________
MissingInputError Tue May 2 13:25:22 2017
PID: 26681 Python 3.6.0: /home/narendra/anaconda3/bin/python
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/joblib/parallel.py in __call__(self=<joblib.parallel.BatchedCalls object>)
126 def __init__(self, iterator_slice):
127 self.items = list(iterator_slice)
128 self._size = len(self.items)
129
130 def __call__(self):
--> 131 return [func(*args, **kwargs) for func, args, kwargs in self.items]
self.items = [(<function _sample>, (), {'chain': 0, 'draws': 500000, 'live_plot': False, 'model': <pymc3.model.Model object>, 'progressbar': True, 'random_seed': 442901656, 'start': {'t1': 25.0, 't2': 120.0}, 'step': <pymc3.step_methods.compound.CompoundStep object>, 'trace': None, 'tune': None})]
132
133 def __len__(self):
134 return self._size
135
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/joblib/parallel.py in <listcomp>(.0=<list_iterator object>)
126 def __init__(self, iterator_slice):
127 self.items = list(iterator_slice)
128 self._size = len(self.items)
129
130 def __call__(self):
--> 131 return [func(*args, **kwargs) for func, args, kwargs in self.items]
func = <function _sample>
args = ()
kwargs = {'chain': 0, 'draws': 500000, 'live_plot': False, 'model': <pymc3.model.Model object>, 'progressbar': True, 'random_seed': 442901656, 'start': {'t1': 25.0, 't2': 120.0}, 'step': <pymc3.step_methods.compound.CompoundStep object>, 'trace': None, 'tune': None}
132
133 def __len__(self):
134 return self._size
135
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py in _sample(draws=500000, step=<pymc3.step_methods.compound.CompoundStep object>, start={'t1': 25.0, 't2': 120.0}, trace=None, chain=0, tune=None, progressbar=True, model=<pymc3.model.Model object>, random_seed=442901656, live_plot=False, **kwargs={})
269 tune, model, random_seed)
270 if progressbar:
271 sampling = tqdm(sampling, total=draws)
272 try:
273 strace = None
--> 274 for it, strace in enumerate(sampling):
it = undefined
strace = None
sampling = 0%| | 0/500000 [00:00<?, ?it/s]
275 if live_plot:
276 if it >= skip_first:
277 trace = MultiTrace([strace])
278 if it == skip_first:
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/tqdm/_tqdm.py in __iter__(self= 0%| | 0/500000 [00:00<?, ?it/s])
828 except AttributeError:
829 raise TqdmDeprecationWarning("""\
830 Please use `tqdm_gui(...)` instead of `tqdm(..., gui=True)`
831 """, fp_write=getattr(self.fp, 'write', sys.stderr.write))
832
--> 833 for obj in iterable:
obj = undefined
iterable = <generator object _iter_sample>
834 yield obj
835 # Update and print the progressbar.
836 # Note: does not call self.update(1) for speed optimisation.
837 n += 1
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py in _iter_sample(draws=500000, step=<pymc3.step_methods.compound.CompoundStep object>, start={'t1': 25.0, 't2': 120.0}, trace=None, chain=0, tune=None, model=<pymc3.model.Model object>, random_seed=442901656)
346 strace = _choose_backend(trace, chain, model=model)
347
348 if len(strace) > 0:
349 _update_start_vals(start, strace.point(-1), model)
350 else:
--> 351 _update_start_vals(start, model.test_point, model)
start = {'t1': 25.0, 't2': 120.0}
model.test_point = {'p_stickbreaking__': array([[ 0.00000000e+00, 0.00000000e+00, 0....00, 3.33066907e-16,
0.00000000e+00]]), 't1_interval__': array([ 0., 0., 0., 0., 0., 0., 0., 0., ..., 0., 0.,
0., 0., 0., 0., 0., 0.]), 't2_interval__': array([ 0., 0., 0., 0., 0., 0., 0., 0., ..., 0., 0.,
0., 0., 0., 0., 0., 0.])}
model = <pymc3.model.Model object>
352
353 try:
354 step = CompoundStep(step)
355 except TypeError:
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py in _update_start_vals(a={'t1': 25.0, 't2': 120.0}, b={'p_stickbreaking__': array([[ 0.00000000e+00, 0.00000000e+00, 0....00, 3.33066907e-16,
0.00000000e+00]]), 't1_interval__': array(-1.9459102153778076, dtype=float32), 't2_interval__': array([ 0., 0., 0., 0., 0., 0., 0., 0., ..., 0., 0.,
0., 0., 0., 0., 0., 0.])}, model=<pymc3.model.Model object>)
462 for name in a:
463 for tname in b:
464 if is_transformed_name(tname) and get_untransformed_name(tname) == name:
465 transform_func = [d.transformation for d in model.deterministics if d.name == name]
466 if transform_func:
--> 467 b[tname] = transform_func[0].forward(a[name]).eval()
b = {'p_stickbreaking__': array([[ 0.00000000e+00, 0.00000000e+00, 0....00, 3.33066907e-16,
0.00000000e+00]]), 't1_interval__': array(-1.9459102153778076, dtype=float32), 't2_interval__': array([ 0., 0., 0., 0., 0., 0., 0., 0., ..., 0., 0.,
0., 0., 0., 0., 0., 0.])}
tname = 't2_interval__'
transform_func.forward = undefined
a = {'t1': 25.0, 't2': 120.0}
468
469 a.update({k: v for k, v in b.items() if k not in a})
470
471 def sample_ppc(trace, samples=None, model=None, vars=None, size=None,
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/gof/graph.py in eval(self=Elemwise{sub,no_inplace}.0, inputs_to_values={})
511 if not hasattr(self, '_fn_cache'):
512 self._fn_cache = dict()
513
514 inputs = tuple(sorted(inputs_to_values.keys(), key=id))
515 if inputs not in self._fn_cache:
--> 516 self._fn_cache[inputs] = theano.function(inputs, self)
self._fn_cache = {}
inputs = ()
self = Elemwise{sub,no_inplace}.0
517 args = [inputs_to_values[param] for param in inputs]
518
519 rval = self._fn_cache[inputs](*args)
520
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/compile/function.py in function(inputs=(), outputs=Elemwise{sub,no_inplace}.0, mode=None, updates=[], givens=[], no_default_updates=False, accept_inplace=False, name='/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py:467', rebuild_strict=True, allow_input_downcast=None, profile=None, on_unused_input=None)
321 accept_inplace=accept_inplace, name=name,
322 rebuild_strict=rebuild_strict,
323 allow_input_downcast=allow_input_downcast,
324 on_unused_input=on_unused_input,
325 profile=profile,
--> 326 output_keys=output_keys)
output_keys = None
327 # We need to add the flag check_aliased inputs if we have any mutable or
328 # borrowed used defined inputs
329 fn._check_for_aliased_inputs = check_for_aliased_inputs
330 return fn
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/compile/pfunc.py in pfunc(params=(), outputs=Elemwise{sub,no_inplace}.0, mode=None, updates=[], givens=[], no_default_updates=False, accept_inplace=False, name='/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py:467', rebuild_strict=True, allow_input_downcast=None, profile=None, on_unused_input=None, output_keys=None)
481 inputs.append(si)
482
483 return orig_function(inputs, cloned_outputs, mode,
484 accept_inplace=accept_inplace, name=name,
485 profile=profile, on_unused_input=on_unused_input,
--> 486 output_keys=output_keys)
output_keys = None
487
488
489 def _pfunc_param_to_in(param, strict=False, allow_downcast=None):
490 if isinstance(param, Constant):
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/compile/function_module.py in orig_function(inputs=[], outputs=Out(Elemwise{sub,no_inplace}.0,False), mode=<theano.compile.mode.Mode object>, accept_inplace=False, name='/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py:467', profile=None, on_unused_input=None, output_keys=None)
1789 outputs,
1790 mode,
1791 accept_inplace=accept_inplace,
1792 profile=profile,
1793 on_unused_input=on_unused_input,
-> 1794 output_keys=output_keys).create(
output_keys = None
output_keys.create = undefined
1795 defaults)
1796
1797 t2 = time.time()
1798 if profile:
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/compile/function_module.py in __init__(self=<theano.compile.function_module.FunctionMaker object>, inputs=[], outputs=[Out(Elemwise{sub,no_inplace}.0,False)], mode=<theano.compile.mode.Mode object>, accept_inplace=False, function_builder=<class 'theano.compile.function_module.Function'>, profile=None, on_unused_input=None, fgraph=None, output_keys=None)
1441 if fgraph is None:
1442 need_opt = True
1443 # make the fgraph (copies the graph, creates NEW INPUT AND
1444 # OUTPUT VARIABLES)
1445 fgraph, additional_outputs = std_fgraph(inputs, outputs,
-> 1446 accept_inplace)
accept_inplace = False
1447 fgraph.profile = profile
1448 else:
1449 # fgraph is already an optimized one
1450 need_opt = False
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/compile/function_module.py in std_fgraph(input_specs=[], output_specs=[Out(Elemwise{sub,no_inplace}.0,False)], accept_inplace=False)
172 out_idx += 1
173
174 orig_outputs = [spec.variable for spec in output_specs] + updates
175
176 fgraph = gof.fg.FunctionGraph(orig_inputs, orig_outputs,
--> 177 update_mapping=update_mapping)
update_mapping = {}
178
179 for node in fgraph.apply_nodes:
180 if getattr(node.op, 'destroy_map', None):
181 if not accept_inplace:
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/gof/fg.py in __init__(self=[Elemwise{sub,no_inplace}(Elemwise{log,no_inplac...}(TensorConstant{130}, TensorConstant{120.0}))))], inputs=[], outputs=[Elemwise{sub,no_inplace}.0], features=[], clone=True, update_mapping={})
175 "input's owner or use graph.clone.")
176 self.__setup_r__(input)
177 self.variables.add(input)
178
179 for output in outputs:
--> 180 self.__import_r__(output, reason="init")
self.__import_r__ = <bound method FunctionGraph.__import_r__ of [Ele...(TensorConstant{130}, TensorConstant{120.0}))))]>
output = Elemwise{sub,no_inplace}.0
181 for i, output in enumerate(outputs):
182 output.clients.append(('output', i))
183
184 self.profile = None
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/gof/fg.py in __import_r__(self=[Elemwise{sub,no_inplace}(Elemwise{log,no_inplac...}(TensorConstant{130}, TensorConstant{120.0}))))], variable=Elemwise{sub,no_inplace}.0, reason='init')
346 reason
347 reason is the name of the optimization or operation in progress.
348 """
349 # Imports the owners of the variables
350 if variable.owner and variable.owner not in self.apply_nodes:
--> 351 self.__import__(variable.owner, reason=reason)
self.__import__ = <bound method FunctionGraph.__import__ of [Elemw...(TensorConstant{130}, TensorConstant{120.0}))))]>
variable.owner = Elemwise{sub,no_inplace}(Elemwise{log,no_inplace}.0, InplaceDimShuffle{x}.0)
reason = 'init'
352 elif (variable.owner is None and
353 not isinstance(variable, graph.Constant) and
354 variable not in self.inputs):
355 global NullType
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/gof/fg.py in __import__(self=[Elemwise{sub,no_inplace}(Elemwise{log,no_inplac...}(TensorConstant{130}, TensorConstant{120.0}))))], apply_node=Elemwise{sub,no_inplace}(Elemwise{log,no_inplace}.0, InplaceDimShuffle{x}.0), check=True, reason='init')
392 "provided and not given a value. Use the "
393 "Theano flag exception_verbosity='high', "
394 "for more information on this error."
395 % (node.inputs.index(r), str(node)))
396 error_msg += get_variable_trace_string(r)
--> 397 raise MissingInputError(error_msg, variable=r)
error_msg = "Input 0 of the graph (indices start from 0), use...osity='high', for more information on this error."
r = t1_interval__
398
399 for node in new_nodes:
400 assert node not in self.apply_nodes
401 self.__setup_node__(node)
MissingInputError: Input 0 of the graph (indices start from 0), used to compute sigmoid(t1_interval__), was not provided and not given a value. Use the Theano flag exception_verbosity='high', for more information on this error.
___________________________________________________________________________
During handling of the above exception, another exception occurred:
JoblibMissingInputError Traceback (most recent call last)
<ipython-input-34-0c062e078a92> in <module>()
1 with model:
----> 2 tr = pm.sample(500000, init = None, step = pm.Metropolis(), njobs = 2, start = {'t1': 25.0, 't2': 120.0})
3
/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py in sample(draws, step, init, n_init, start, trace, chain, njobs, tune, nuts_kwargs, step_kwargs, progressbar, model, random_seed, live_plot, **kwargs)
257 sample_func = _sample
258
--> 259 return sample_func(**sample_args)
260
261
/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py in _mp_sample(**kwargs)
441 random_seed=rseed[i],
442 start=start_vals[i],
--> 443 **kwargs) for i in range(njobs))
444 return merge_traces(traces)
445
/home/narendra/anaconda3/lib/python3.6/site-packages/joblib/parallel.py in __call__(self, iterable)
766 # consumption.
767 self._iterating = False
--> 768 self.retrieve()
769 # Make sure that we get a last message telling us we are done
770 elapsed_time = time.time() - self._start_time
/home/narendra/anaconda3/lib/python3.6/site-packages/joblib/parallel.py in retrieve(self)
717 ensure_ready = self._managed_backend
718 backend.abort_everything(ensure_ready=ensure_ready)
--> 719 raise exception
720
721 def __call__(self, iterable):
JoblibMissingInputError: JoblibMissingInputError
___________________________________________________________________________
Multiprocessing exception:
...........................................................................
/home/narendra/anaconda3/bin/ipython in <module>()
1 #!/home/narendra/anaconda3/bin/python
2 if __name__ == '__main__':
3 import sys
4 import IPython
5
----> 6 sys.exit(IPython.start_ipython())
7
8
9
10
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/IPython/__init__.py in start_ipython(argv=None, **kwargs={})
114 kwargs : various, optional
115 Any other kwargs will be passed to the Application constructor,
116 such as `config`.
117 """
118 from IPython.terminal.ipapp import launch_new_instance
--> 119 return launch_new_instance(argv=argv, **kwargs)
launch_new_instance = <bound method Application.launch_instance of <class 'IPython.terminal.ipapp.TerminalIPythonApp'>>
argv = None
kwargs = {}
120
121 def start_kernel(argv=None, **kwargs):
122 """Launch a normal IPython kernel instance (as opposed to embedded)
123
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/traitlets/config/application.py in launch_instance(cls=<class 'IPython.terminal.ipapp.TerminalIPythonApp'>, argv=None, **kwargs={})
653
654 If a global instance already exists, this reinitializes and starts it
655 """
656 app = cls.instance(**kwargs)
657 app.initialize(argv)
--> 658 app.start()
app.start = <bound method TerminalIPythonApp.start of <IPython.terminal.ipapp.TerminalIPythonApp object>>
659
660 #-----------------------------------------------------------------------------
661 # utility functions, for convenience
662 #-----------------------------------------------------------------------------
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/IPython/terminal/ipapp.py in start(self=<IPython.terminal.ipapp.TerminalIPythonApp object>)
343 if self.subapp is not None:
344 return self.subapp.start()
345 # perform any prexec steps:
346 if self.interact:
347 self.log.debug("Starting IPython's mainloop...")
--> 348 self.shell.mainloop()
self.shell.mainloop = <bound method TerminalInteractiveShell.mainloop ...nteractiveshell.TerminalInteractiveShell object>>
349 else:
350 self.log.debug("IPython not interactive...")
351
352 def load_default_config(ipython_dir=None):
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/IPython/terminal/interactiveshell.py in mainloop(self=<IPython.terminal.interactiveshell.TerminalInteractiveShell object>, display_banner=<object object>)
435 # out of our internal code.
436 if display_banner is not DISPLAY_BANNER_DEPRECATED:
437 warn('mainloop `display_banner` argument is deprecated since IPython 5.0. Call `show_banner()` if needed.', DeprecationWarning, stacklevel=2)
438 while True:
439 try:
--> 440 self.interact()
self.interact = <bound method TerminalInteractiveShell.interact ...nteractiveshell.TerminalInteractiveShell object>>
441 break
442 except KeyboardInterrupt:
443 print("\nKeyboardInterrupt escaped interact()\n")
444
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/IPython/terminal/interactiveshell.py in interact(self=<IPython.terminal.interactiveshell.TerminalInteractiveShell object>, display_banner=<object object>)
426 or self.ask_yes_no('Do you really want to exit ([y]/n)?','y','n'):
427 self.ask_exit()
428
429 else:
430 if code:
--> 431 self.run_cell(code, store_history=True)
self.run_cell = <bound method InteractiveShell.run_cell of <IPyt...nteractiveshell.TerminalInteractiveShell object>>
code = "with model:\n tr = pm.sample(500000, init = No...jobs = 2, start = {'t1': 25.0, 't2': 120.0})\n "
432
433 def mainloop(self, display_banner=DISPLAY_BANNER_DEPRECATED):
434 # An extra layer of protection in case someone mashing Ctrl-C breaks
435 # out of our internal code.
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py in run_cell(self=<IPython.terminal.interactiveshell.TerminalInteractiveShell object>, raw_cell="with model:\n tr = pm.sample(500000, init = No...jobs = 2, start = {'t1': 25.0, 't2': 120.0})\n ", store_history=True, silent=False, shell_futures=True)
2712 self.displayhook.exec_result = result
2713
2714 # Execute the user code
2715 interactivity = "none" if silent else self.ast_node_interactivity
2716 has_raised = self.run_ast_nodes(code_ast.body, cell_name,
-> 2717 interactivity=interactivity, compiler=compiler, result=result)
interactivity = 'last_expr'
compiler = <IPython.core.compilerop.CachingCompiler object>
2718
2719 self.last_execution_succeeded = not has_raised
2720
2721 # Reset this so later displayed values do not modify the
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py in run_ast_nodes(self=<IPython.terminal.interactiveshell.TerminalInteractiveShell object>, nodelist=[<_ast.With object>], cell_name='<ipython-input-34-0c062e078a92>', interactivity='none', compiler=<IPython.core.compilerop.CachingCompiler object>, result=<ExecutionResult object at 7f690b963d68, executi..._before_exec=None error_in_exec=None result=None>)
2816
2817 try:
2818 for i, node in enumerate(to_run_exec):
2819 mod = ast.Module([node])
2820 code = compiler(mod, cell_name, "exec")
-> 2821 if self.run_code(code, result):
self.run_code = <bound method InteractiveShell.run_code of <IPyt...nteractiveshell.TerminalInteractiveShell object>>
code = <code object <module> at 0x7f690a0fd150, file "<ipython-input-34-0c062e078a92>", line 1>
result = <ExecutionResult object at 7f690b963d68, executi..._before_exec=None error_in_exec=None result=None>
2822 return True
2823
2824 for i, node in enumerate(to_run_interactive):
2825 mod = ast.Interactive([node])
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py in run_code(self=<IPython.terminal.interactiveshell.TerminalInteractiveShell object>, code_obj=<code object <module> at 0x7f690a0fd150, file "<ipython-input-34-0c062e078a92>", line 1>, result=<ExecutionResult object at 7f690b963d68, executi..._before_exec=None error_in_exec=None result=None>)
2876 outflag = 1 # happens in more places, so it's easier as default
2877 try:
2878 try:
2879 self.hooks.pre_run_code_hook()
2880 #rprint('Running code', repr(code_obj)) # dbg
-> 2881 exec(code_obj, self.user_global_ns, self.user_ns)
code_obj = <code object <module> at 0x7f690a0fd150, file "<ipython-input-34-0c062e078a92>", line 1>
self.user_global_ns = {'In': ['', "get_ipython().magic('cd Desktop/')", "get_ipython().magic('ls ')", 'import numpy as np', 'import pymc3 as pm', 'import theano.tensor as tt', "set1 = np.load('set1.npy')", "set2 = np.load('set2.npy')", "data = np.load('data.npy')", 'data.shape', "get_ipython().magic('paste')", "with model:\n tr = pm.sample(500000, init = No...jobs = 2, start = {'t1': 25.0, 't2': 120.0})\n ", 't1.tag.test_value', 't2.tag.test_value', 'with model:\n tr = pm.sample(500000, init = None, step = pm.Metropolis(), njobs = 2)\n ', "with pm.Model() as model:\n p = pm.Dirichlet('p', np.ones(17), shape = (7, 17))\n ", "with model:\n t1 = pm.Uniform('t1', lower = 20...', lower = t1 + 10, upper = 130, shape = 32)\n ", 'with model:\n states1 = tt.switch(t1 >= np.rep... 32, axis = 1), states1, palatability[2, :])\n ', 'x = np.arange(2000)', 'y = 10*x + 10 + np.random.random(2000)', ...], 'Out': {9: (32, 150), 12: array([ 40., 40., 40., 40., 40., 40., 40.,... 40., 40., 40., 40., 40., 40., 40., 40.]), 13: array([ 95., 95., 95., 95., 95., 95., 95.,... 95., 95., 95., 95., 95., 95., 95., 95.]), 21: [<matplotlib.lines.Line2D object>], 24: [<matplotlib.lines.Line2D object>], 27: (2000,), 28: (2000,), 31: array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,...2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2]), 32: array([5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,...4, 4, 4, 4, 4,
4, 3, 3, 3, 3, 3, 3, 3, 3])}, '_': array([5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,...4, 4, 4, 4, 4,
4, 3, 3, 3, 3, 3, 3, 3, 3]), '_12': array([ 40., 40., 40., 40., 40., 40., 40.,... 40., 40., 40., 40., 40., 40., 40., 40.]), '_13': array([ 95., 95., 95., 95., 95., 95., 95.,... 95., 95., 95., 95., 95., 95., 95., 95.]), '_21': [<matplotlib.lines.Line2D object>], '_24': [<matplotlib.lines.Line2D object>], '_27': (2000,), '_28': (2000,), '_31': array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,...2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2]), ...}
self.user_ns = {'In': ['', "get_ipython().magic('cd Desktop/')", "get_ipython().magic('ls ')", 'import numpy as np', 'import pymc3 as pm', 'import theano.tensor as tt', "set1 = np.load('set1.npy')", "set2 = np.load('set2.npy')", "data = np.load('data.npy')", 'data.shape', "get_ipython().magic('paste')", "with model:\n tr = pm.sample(500000, init = No...jobs = 2, start = {'t1': 25.0, 't2': 120.0})\n ", 't1.tag.test_value', 't2.tag.test_value', 'with model:\n tr = pm.sample(500000, init = None, step = pm.Metropolis(), njobs = 2)\n ', "with pm.Model() as model:\n p = pm.Dirichlet('p', np.ones(17), shape = (7, 17))\n ", "with model:\n t1 = pm.Uniform('t1', lower = 20...', lower = t1 + 10, upper = 130, shape = 32)\n ", 'with model:\n states1 = tt.switch(t1 >= np.rep... 32, axis = 1), states1, palatability[2, :])\n ', 'x = np.arange(2000)', 'y = 10*x + 10 + np.random.random(2000)', ...], 'Out': {9: (32, 150), 12: array([ 40., 40., 40., 40., 40., 40., 40.,... 40., 40., 40., 40., 40., 40., 40., 40.]), 13: array([ 95., 95., 95., 95., 95., 95., 95.,... 95., 95., 95., 95., 95., 95., 95., 95.]), 21: [<matplotlib.lines.Line2D object>], 24: [<matplotlib.lines.Line2D object>], 27: (2000,), 28: (2000,), 31: array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,...2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2]), 32: array([5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,...4, 4, 4, 4, 4,
4, 3, 3, 3, 3, 3, 3, 3, 3])}, '_': array([5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,...4, 4, 4, 4, 4,
4, 3, 3, 3, 3, 3, 3, 3, 3]), '_12': array([ 40., 40., 40., 40., 40., 40., 40.,... 40., 40., 40., 40., 40., 40., 40., 40.]), '_13': array([ 95., 95., 95., 95., 95., 95., 95.,... 95., 95., 95., 95., 95., 95., 95., 95.]), '_21': [<matplotlib.lines.Line2D object>], '_24': [<matplotlib.lines.Line2D object>], '_27': (2000,), '_28': (2000,), '_31': array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,...2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2]), ...}
2882 finally:
2883 # Reset our crash handler in place
2884 sys.excepthook = old_excepthook
2885 except SystemExit as e:
...........................................................................
/home/narendra/Desktop/<ipython-input-34-0c062e078a92> in <module>()
1
----> 2
3
4
5 with model:
6 tr = pm.sample(500000, init = None, step = pm.Metropolis(), njobs = 2, start = {'t1': 25.0, 't2': 120.0})
7
8
9
10
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py in sample(draws=500000, step=<pymc3.step_methods.compound.CompoundStep object>, init=None, n_init=200000, start={'t1': 25.0, 't2': 120.0}, trace=None, chain=0, njobs=2, tune=None, nuts_kwargs=None, step_kwargs=None, progressbar=True, model=<pymc3.model.Model object>, random_seed=-1, live_plot=False, **kwargs={})
254 sample_func = _mp_sample
255 sample_args['njobs'] = njobs
256 else:
257 sample_func = _sample
258
--> 259 return sample_func(**sample_args)
sample_func = <function _mp_sample>
sample_args = {'chain': 0, 'draws': 500000, 'live_plot': False, 'model': <pymc3.model.Model object>, 'njobs': 2, 'progressbar': True, 'random_seed': -1, 'start': {'t1': 25.0, 't2': 120.0}, 'step': <pymc3.step_methods.compound.CompoundStep object>, 'trace': None, ...}
260
261
262 def _sample(draws, step=None, start=None, trace=None, chain=0, tune=None,
263 progressbar=True, model=None, random_seed=-1, live_plot=False,
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py in _mp_sample(**kwargs={'draws': 500000, 'live_plot': False, 'model': <pymc3.model.Model object>, 'step': <pymc3.step_methods.compound.CompoundStep object>, 'trace': None, 'tune': None})
438 pbars = [kwargs.pop('progressbar')] + [False] * (njobs - 1)
439 traces = Parallel(n_jobs=njobs)(delayed(_sample)(chain=chains[i],
440 progressbar=pbars[i],
441 random_seed=rseed[i],
442 start=start_vals[i],
--> 443 **kwargs) for i in range(njobs))
kwargs = {'draws': 500000, 'live_plot': False, 'model': <pymc3.model.Model object>, 'step': <pymc3.step_methods.compound.CompoundStep object>, 'trace': None, 'tune': None}
njobs = 2
444 return merge_traces(traces)
445
446
447 def stop_tuning(step):
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/joblib/parallel.py in __call__(self=Parallel(n_jobs=2), iterable=<generator object _mp_sample.<locals>.<genexpr>>)
763 if pre_dispatch == "all" or n_jobs == 1:
764 # The iterable was consumed all at once by the above for loop.
765 # No need to wait for async callbacks to trigger to
766 # consumption.
767 self._iterating = False
--> 768 self.retrieve()
self.retrieve = <bound method Parallel.retrieve of Parallel(n_jobs=2)>
769 # Make sure that we get a last message telling us we are done
770 elapsed_time = time.time() - self._start_time
771 self._print('Done %3i out of %3i | elapsed: %s finished',
772 (len(self._output), len(self._output),
---------------------------------------------------------------------------
Sub-process traceback:
---------------------------------------------------------------------------
MissingInputError Tue May 2 13:25:22 2017
PID: 26681 Python 3.6.0: /home/narendra/anaconda3/bin/python
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/joblib/parallel.py in __call__(self=<joblib.parallel.BatchedCalls object>)
126 def __init__(self, iterator_slice):
127 self.items = list(iterator_slice)
128 self._size = len(self.items)
129
130 def __call__(self):
--> 131 return [func(*args, **kwargs) for func, args, kwargs in self.items]
self.items = [(<function _sample>, (), {'chain': 0, 'draws': 500000, 'live_plot': False, 'model': <pymc3.model.Model object>, 'progressbar': True, 'random_seed': 442901656, 'start': {'t1': 25.0, 't2': 120.0}, 'step': <pymc3.step_methods.compound.CompoundStep object>, 'trace': None, 'tune': None})]
132
133 def __len__(self):
134 return self._size
135
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/joblib/parallel.py in <listcomp>(.0=<list_iterator object>)
126 def __init__(self, iterator_slice):
127 self.items = list(iterator_slice)
128 self._size = len(self.items)
129
130 def __call__(self):
--> 131 return [func(*args, **kwargs) for func, args, kwargs in self.items]
func = <function _sample>
args = ()
kwargs = {'chain': 0, 'draws': 500000, 'live_plot': False, 'model': <pymc3.model.Model object>, 'progressbar': True, 'random_seed': 442901656, 'start': {'t1': 25.0, 't2': 120.0}, 'step': <pymc3.step_methods.compound.CompoundStep object>, 'trace': None, 'tune': None}
132
133 def __len__(self):
134 return self._size
135
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py in _sample(draws=500000, step=<pymc3.step_methods.compound.CompoundStep object>, start={'t1': 25.0, 't2': 120.0}, trace=None, chain=0, tune=None, progressbar=True, model=<pymc3.model.Model object>, random_seed=442901656, live_plot=False, **kwargs={})
269 tune, model, random_seed)
270 if progressbar:
271 sampling = tqdm(sampling, total=draws)
272 try:
273 strace = None
--> 274 for it, strace in enumerate(sampling):
it = undefined
strace = None
sampling = 0%| | 0/500000 [00:00<?, ?it/s]
275 if live_plot:
276 if it >= skip_first:
277 trace = MultiTrace([strace])
278 if it == skip_first:
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/tqdm/_tqdm.py in __iter__(self= 0%| | 0/500000 [00:00<?, ?it/s])
828 except AttributeError:
829 raise TqdmDeprecationWarning("""\
830 Please use `tqdm_gui(...)` instead of `tqdm(..., gui=True)`
831 """, fp_write=getattr(self.fp, 'write', sys.stderr.write))
832
--> 833 for obj in iterable:
obj = undefined
iterable = <generator object _iter_sample>
834 yield obj
835 # Update and print the progressbar.
836 # Note: does not call self.update(1) for speed optimisation.
837 n += 1
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py in _iter_sample(draws=500000, step=<pymc3.step_methods.compound.CompoundStep object>, start={'t1': 25.0, 't2': 120.0}, trace=None, chain=0, tune=None, model=<pymc3.model.Model object>, random_seed=442901656)
346 strace = _choose_backend(trace, chain, model=model)
347
348 if len(strace) > 0:
349 _update_start_vals(start, strace.point(-1), model)
350 else:
--> 351 _update_start_vals(start, model.test_point, model)
start = {'t1': 25.0, 't2': 120.0}
model.test_point = {'p_stickbreaking__': array([[ 0.00000000e+00, 0.00000000e+00, 0....00, 3.33066907e-16,
0.00000000e+00]]), 't1_interval__': array([ 0., 0., 0., 0., 0., 0., 0., 0., ..., 0., 0.,
0., 0., 0., 0., 0., 0.]), 't2_interval__': array([ 0., 0., 0., 0., 0., 0., 0., 0., ..., 0., 0.,
0., 0., 0., 0., 0., 0.])}
model = <pymc3.model.Model object>
352
353 try:
354 step = CompoundStep(step)
355 except TypeError:
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py in _update_start_vals(a={'t1': 25.0, 't2': 120.0}, b={'p_stickbreaking__': array([[ 0.00000000e+00, 0.00000000e+00, 0....00, 3.33066907e-16,
0.00000000e+00]]), 't1_interval__': array(-1.9459102153778076, dtype=float32), 't2_interval__': array([ 0., 0., 0., 0., 0., 0., 0., 0., ..., 0., 0.,
0., 0., 0., 0., 0., 0.])}, model=<pymc3.model.Model object>)
462 for name in a:
463 for tname in b:
464 if is_transformed_name(tname) and get_untransformed_name(tname) == name:
465 transform_func = [d.transformation for d in model.deterministics if d.name == name]
466 if transform_func:
--> 467 b[tname] = transform_func[0].forward(a[name]).eval()
b = {'p_stickbreaking__': array([[ 0.00000000e+00, 0.00000000e+00, 0....00, 3.33066907e-16,
0.00000000e+00]]), 't1_interval__': array(-1.9459102153778076, dtype=float32), 't2_interval__': array([ 0., 0., 0., 0., 0., 0., 0., 0., ..., 0., 0.,
0., 0., 0., 0., 0., 0.])}
tname = 't2_interval__'
transform_func.forward = undefined
a = {'t1': 25.0, 't2': 120.0}
468
469 a.update({k: v for k, v in b.items() if k not in a})
470
471 def sample_ppc(trace, samples=None, model=None, vars=None, size=None,
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/gof/graph.py in eval(self=Elemwise{sub,no_inplace}.0, inputs_to_values={})
511 if not hasattr(self, '_fn_cache'):
512 self._fn_cache = dict()
513
514 inputs = tuple(sorted(inputs_to_values.keys(), key=id))
515 if inputs not in self._fn_cache:
--> 516 self._fn_cache[inputs] = theano.function(inputs, self)
self._fn_cache = {}
inputs = ()
self = Elemwise{sub,no_inplace}.0
517 args = [inputs_to_values[param] for param in inputs]
518
519 rval = self._fn_cache[inputs](*args)
520
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/compile/function.py in function(inputs=(), outputs=Elemwise{sub,no_inplace}.0, mode=None, updates=[], givens=[], no_default_updates=False, accept_inplace=False, name='/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py:467', rebuild_strict=True, allow_input_downcast=None, profile=None, on_unused_input=None)
321 accept_inplace=accept_inplace, name=name,
322 rebuild_strict=rebuild_strict,
323 allow_input_downcast=allow_input_downcast,
324 on_unused_input=on_unused_input,
325 profile=profile,
--> 326 output_keys=output_keys)
output_keys = None
327 # We need to add the flag check_aliased inputs if we have any mutable or
328 # borrowed used defined inputs
329 fn._check_for_aliased_inputs = check_for_aliased_inputs
330 return fn
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/compile/pfunc.py in pfunc(params=(), outputs=Elemwise{sub,no_inplace}.0, mode=None, updates=[], givens=[], no_default_updates=False, accept_inplace=False, name='/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py:467', rebuild_strict=True, allow_input_downcast=None, profile=None, on_unused_input=None, output_keys=None)
481 inputs.append(si)
482
483 return orig_function(inputs, cloned_outputs, mode,
484 accept_inplace=accept_inplace, name=name,
485 profile=profile, on_unused_input=on_unused_input,
--> 486 output_keys=output_keys)
output_keys = None
487
488
489 def _pfunc_param_to_in(param, strict=False, allow_downcast=None):
490 if isinstance(param, Constant):
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/compile/function_module.py in orig_function(inputs=[], outputs=Out(Elemwise{sub,no_inplace}.0,False), mode=<theano.compile.mode.Mode object>, accept_inplace=False, name='/home/narendra/anaconda3/lib/python3.6/site-packages/pymc3/sampling.py:467', profile=None, on_unused_input=None, output_keys=None)
1789 outputs,
1790 mode,
1791 accept_inplace=accept_inplace,
1792 profile=profile,
1793 on_unused_input=on_unused_input,
-> 1794 output_keys=output_keys).create(
output_keys = None
output_keys.create = undefined
1795 defaults)
1796
1797 t2 = time.time()
1798 if profile:
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/compile/function_module.py in __init__(self=<theano.compile.function_module.FunctionMaker object>, inputs=[], outputs=[Out(Elemwise{sub,no_inplace}.0,False)], mode=<theano.compile.mode.Mode object>, accept_inplace=False, function_builder=<class 'theano.compile.function_module.Function'>, profile=None, on_unused_input=None, fgraph=None, output_keys=None)
1441 if fgraph is None:
1442 need_opt = True
1443 # make the fgraph (copies the graph, creates NEW INPUT AND
1444 # OUTPUT VARIABLES)
1445 fgraph, additional_outputs = std_fgraph(inputs, outputs,
-> 1446 accept_inplace)
accept_inplace = False
1447 fgraph.profile = profile
1448 else:
1449 # fgraph is already an optimized one
1450 need_opt = False
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/compile/function_module.py in std_fgraph(input_specs=[], output_specs=[Out(Elemwise{sub,no_inplace}.0,False)], accept_inplace=False)
172 out_idx += 1
173
174 orig_outputs = [spec.variable for spec in output_specs] + updates
175
176 fgraph = gof.fg.FunctionGraph(orig_inputs, orig_outputs,
--> 177 update_mapping=update_mapping)
update_mapping = {}
178
179 for node in fgraph.apply_nodes:
180 if getattr(node.op, 'destroy_map', None):
181 if not accept_inplace:
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/gof/fg.py in __init__(self=[Elemwise{sub,no_inplace}(Elemwise{log,no_inplac...}(TensorConstant{130}, TensorConstant{120.0}))))], inputs=[], outputs=[Elemwise{sub,no_inplace}.0], features=[], clone=True, update_mapping={})
175 "input's owner or use graph.clone.")
176 self.__setup_r__(input)
177 self.variables.add(input)
178
179 for output in outputs:
--> 180 self.__import_r__(output, reason="init")
self.__import_r__ = <bound method FunctionGraph.__import_r__ of [Ele...(TensorConstant{130}, TensorConstant{120.0}))))]>
output = Elemwise{sub,no_inplace}.0
181 for i, output in enumerate(outputs):
182 output.clients.append(('output', i))
183
184 self.profile = None
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/gof/fg.py in __import_r__(self=[Elemwise{sub,no_inplace}(Elemwise{log,no_inplac...}(TensorConstant{130}, TensorConstant{120.0}))))], variable=Elemwise{sub,no_inplace}.0, reason='init')
346 reason
347 reason is the name of the optimization or operation in progress.
348 """
349 # Imports the owners of the variables
350 if variable.owner and variable.owner not in self.apply_nodes:
--> 351 self.__import__(variable.owner, reason=reason)
self.__import__ = <bound method FunctionGraph.__import__ of [Elemw...(TensorConstant{130}, TensorConstant{120.0}))))]>
variable.owner = Elemwise{sub,no_inplace}(Elemwise{log,no_inplace}.0, InplaceDimShuffle{x}.0)
reason = 'init'
352 elif (variable.owner is None and
353 not isinstance(variable, graph.Constant) and
354 variable not in self.inputs):
355 global NullType
...........................................................................
/home/narendra/anaconda3/lib/python3.6/site-packages/theano/gof/fg.py in __import__(self=[Elemwise{sub,no_inplace}(Elemwise{log,no_inplac...}(TensorConstant{130}, TensorConstant{120.0}))))], apply_node=Elemwise{sub,no_inplace}(Elemwise{log,no_inplace}.0, InplaceDimShuffle{x}.0), check=True, reason='init')
392 "provided and not given a value. Use the "
393 "Theano flag exception_verbosity='high', "
394 "for more information on this error."
395 % (node.inputs.index(r), str(node)))
396 error_msg += get_variable_trace_string(r)
--> 397 raise MissingInputError(error_msg, variable=r)
error_msg = "Input 0 of the graph (indices start from 0), use...osity='high', for more information on this error."
r = t1_interval__
398
399 for node in new_nodes:
400 assert node not in self.apply_nodes
401 self.__setup_node__(node)
MissingInputError: Input 0 of the graph (indices start from 0), used to compute sigmoid(t1_interval__), was not provided and not given a value. Use the Theano flag exception_verbosity='high', for more information on this error.
___________________________________________________________________________
Same model, sampled without the start argument:
In [36]: with model:
...: tr = pm.sample(5000, init = None, step = pm.Metropolis(), njobs = 2)
...:
100%|██████████████████████████████████████████████████████████████████████████████████████████████████| 5000/5000 [00:12<00:00, 412.09it/s]
Metadata
Metadata
Assignees
Labels
No labels