Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elliptical slice sampling error in GP notebook #2348

Closed
fonnesbeck opened this issue Jun 23, 2017 · 2 comments
Closed

Elliptical slice sampling error in GP notebook #2348

fonnesbeck opened this issue Jun 23, 2017 · 2 comments

Comments

@fonnesbeck
Copy link
Member

Elliptical slice sampling generates an AttributeError in the GP notebook, related to a missing test value:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/Users/fonnescj/anaconda3/envs/dev/lib/python3.6/site-packages/theano/gof/op.py in __call__(self, *inputs, **kwargs)
    624                 try:
--> 625                     storage_map[ins] = [self._get_test_value(ins)]
    626                     compute_map[ins] = [True]

/Users/fonnescj/anaconda3/envs/dev/lib/python3.6/site-packages/theano/gof/op.py in _get_test_value(cls, v)
    580         detailed_err_msg = utils.get_variable_trace_string(v)
--> 581         raise AttributeError('%s has no test value %s' % (v, detailed_err_msg))
    582 

AttributeError: Elemwise{add,no_inplace}.0 has no test value  
Backtrace when that variable is created:

  File "/Users/fonnescj/anaconda3/envs/dev/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 235, in dispatch_shell
    handler(stream, idents, msg)
  File "/Users/fonnescj/anaconda3/envs/dev/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 399, in execute_request
    user_expressions, allow_stdin)
  File "/Users/fonnescj/anaconda3/envs/dev/lib/python3.6/site-packages/ipykernel/ipkernel.py", line 196, in do_execute
    res = shell.run_cell(code, store_history=store_history, silent=silent)
  File "/Users/fonnescj/anaconda3/envs/dev/lib/python3.6/site-packages/ipykernel/zmqshell.py", line 533, in run_cell
    return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
  File "/Users/fonnescj/anaconda3/envs/dev/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2683, in run_cell
    interactivity=interactivity, compiler=compiler, result=result)
  File "/Users/fonnescj/anaconda3/envs/dev/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2787, in run_ast_nodes
    if self.run_code(code, result):
  File "/Users/fonnescj/anaconda3/envs/dev/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2847, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-393c5bba237e>", line 19, in <module>
    K_noise = K + noise * np.eye(n)


During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
<ipython-input-4-59015ba86711> in <module>()
      8 
      9     # Interpolate function values using noisy covariance matrix
---> 10     L = tt.slinalg.cholesky(K_noise)
     11     f_pred = pm.Deterministic('f_pred', tt.dot(K_s.T, tt.slinalg.solve(L.T, tt.slinalg.solve(L, f_sample))))
     12 

/Users/fonnescj/anaconda3/envs/dev/lib/python3.6/site-packages/theano/gof/op.py in __call__(self, *inputs, **kwargs)
    637                         raise ValueError(
    638                             'Cannot compute test value: input %i (%s) of Op %s missing default value. %s' %
--> 639                             (i, ins, node, detailed_err_msg))
    640                     elif config.compute_test_value == 'ignore':
    641                         # silently skip test

ValueError: Cannot compute test value: input 0 (Elemwise{add,no_inplace}.0) of Op Cholesky{lower=True, destructive=False}(Elemwise{add,no_inplace}.0) missing default value.  
Backtrace when that variable is created:

  File "/Users/fonnescj/anaconda3/envs/dev/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 235, in dispatch_shell
    handler(stream, idents, msg)
  File "/Users/fonnescj/anaconda3/envs/dev/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 399, in execute_request
    user_expressions, allow_stdin)
  File "/Users/fonnescj/anaconda3/envs/dev/lib/python3.6/site-packages/ipykernel/ipkernel.py", line 196, in do_execute
    res = shell.run_cell(code, store_history=store_history, silent=silent)
  File "/Users/fonnescj/anaconda3/envs/dev/lib/python3.6/site-packages/ipykernel/zmqshell.py", line 533, in run_cell
    return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
  File "/Users/fonnescj/anaconda3/envs/dev/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2683, in run_cell
    interactivity=interactivity, compiler=compiler, result=result)
  File "/Users/fonnescj/anaconda3/envs/dev/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2787, in run_ast_nodes
    if self.run_code(code, result):
  File "/Users/fonnescj/anaconda3/envs/dev/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2847, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-393c5bba237e>", line 19, in <module>
    K_noise = K + noise * np.eye(n)
@fonnesbeck
Copy link
Member Author

Fixed.

@michaelosthege
Copy link
Member

michaelosthege commented Jun 28, 2018

I got the same exception today, with a fresh installation from master. I tried

import theano
theano.config.compute_test_value = "ignore"

but then instead of the above error (L = tt.slinalg.cholesky(K_noise)), my notebook crashes on a theano compilation problem.

UPDATE: Turned out my Theano was broken. Should've done theano.test() earlier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants