Skip to content

Conversation

@javdrher
Copy link
Member

@javdrher javdrher commented May 1, 2017

Code from the optdemo repository. Not to be merged yet until tests pass.

@1Reinier I'm assuming these are the failures you encountered? Weirdly enough they are solved on my system, however on most other systems they fail. I'm thinking completely resetting the model hyperparameters would be the most robust solution. I added you as a reviewer for the branch if thats ok, feel free to comment on problems.

@javdrher javdrher requested a review from 1Reinier May 1, 2017 12:02
@1Reinier
Copy link

1Reinier commented May 2, 2017

The tests runs fine in nose for me now, but python -m unittest gives some errors.

Seems like GPflow's transforms.py lines 129 and 140 are producing multiple overflow errors in exp, and line 140 occasionally has a divide by zero error.

Also, looks like there are some test misspecifications?

/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:129: RuntimeWarning: overflow encountered in exp
  result = np.log(1. + np.exp(x)) + self._lower
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: overflow encountered in exp
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: divide by zero encountered in log
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
./home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:129: RuntimeWarning: overflow encountered in exp
  result = np.log(1. + np.exp(x)) + self._lower
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: overflow encountered in exp
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: divide by zero encountered in log
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
./home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:129: RuntimeWarning: overflow encountered in exp
  result = np.log(1. + np.exp(x)) + self._lower
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: overflow encountered in exp
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: divide by zero encountered in log
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
../home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:129: RuntimeWarning: overflow encountered in exp
  result = np.log(1. + np.exp(x)) + self._lower
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: divide by zero encountered in log
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: overflow encountered in exp
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
./home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/tensorflow/python/util/deprecation.py:211: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
  arg_spec = inspect.getargspec(func)
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/tensorflow/contrib/labeled_tensor/python/ops/_typecheck.py:233: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
  spec = inspect.getargspec(f)
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/tensorflow/python/framework/function.py:807: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
  argspec = inspect.getargspec(func)
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/tensorflow/contrib/distributions/python/ops/distribution.py:851: PendingDeprecationWarning: Please use `prob` instead of `pdf`. `pdf` will be deprecated in December 2016.
  PendingDeprecationWarning)
./home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:129: RuntimeWarning: overflow encountered in exp
  result = np.log(1. + np.exp(x)) + self._lower
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: divide by zero encountered in log
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: overflow encountered in exp
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/tensorflow/contrib/distributions/python/ops/distribution.py:851: PendingDeprecationWarning: Please use `prob` instead of `pdf`. `pdf` will be deprecated in December 2016.
  PendingDeprecationWarning)
../home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:129: RuntimeWarning: overflow encountered in exp
  result = np.log(1. + np.exp(x)) + self._lower
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: divide by zero encountered in log
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: overflow encountered in exp
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
./home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:129: RuntimeWarning: overflow encountered in exp
  result = np.log(1. + np.exp(x)) + self._lower
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: divide by zero encountered in log
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: overflow encountered in exp
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
../home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:129: RuntimeWarning: overflow encountered in exp
  result = np.log(1. + np.exp(x)) + self._lower
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: divide by zero encountered in log
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: overflow encountered in exp
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
./home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/tensorflow/contrib/distributions/python/ops/distribution.py:851: PendingDeprecationWarning: Please use `prob` instead of `pdf`. `pdf` will be deprecated in December 2016.
  PendingDeprecationWarning)
../home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:129: RuntimeWarning: overflow encountered in exp
  result = np.log(1. + np.exp(x)) + self._lower
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: overflow encountered in exp
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: divide by zero encountered in log
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/tensorflow/contrib/distributions/python/ops/distribution.py:851: PendingDeprecationWarning: Please use `prob` instead of `pdf`. `pdf` will be deprecated in December 2016.
  PendingDeprecationWarning)
.../home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:129: RuntimeWarning: overflow encountered in exp
  result = np.log(1. + np.exp(x)) + self._lower
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: divide by zero encountered in log
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: overflow encountered in exp
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
./home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/tensorflow/contrib/distributions/python/ops/distribution.py:851: PendingDeprecationWarning: Please use `prob` instead of `pdf`. `pdf` will be deprecated in December 2016.
  PendingDeprecationWarning)
.../home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:129: RuntimeWarning: overflow encountered in exp
  result = np.log(1. + np.exp(x)) + self._lower
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: overflow encountered in exp
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: divide by zero encountered in log
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
./home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:129: RuntimeWarning: overflow encountered in exp
  result = np.log(1. + np.exp(x)) + self._lower
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: divide by zero encountered in log
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: overflow encountered in exp
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
.../home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:129: RuntimeWarning: overflow encountered in exp
  result = np.log(1. + np.exp(x)) + self._lower
./home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: divide by zero encountered in log
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: overflow encountered in exp
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
.EEEEEEE....E.........../home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:129: RuntimeWarning: overflow encountered in exp
  result = np.log(1. + np.exp(x)) + self._lower
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: overflow encountered in exp
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
/home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/GPflow-0.3.5-py3.5.egg/GPflow/transforms.py:140: RuntimeWarning: divide by zero encountered in log
  result = np.log(np.exp(y - self._lower) - np.ones(1, np_float_type))
../home/reinier/anaconda3/envs/gptest/lib/python3.5/site-packages/tensorflow/contrib/distributions/python/ops/distribution.py:851: PendingDeprecationWarning: Please use `prob` instead of `pdf`. `pdf` will be deprecated in December 2016.
  PendingDeprecationWarning)
..................EE
======================================================================
ERROR: test_data (testing.test_acquisition._AcquisitionBinaryOperatorTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/reinier/GPflowOpt/testing/test_acquisition.py", line 137, in test_data
    super(_AcquisitionBinaryOperatorTest, self).test_data()
  File "/home/reinier/GPflowOpt/testing/test_acquisition.py", line 52, in test_data
    l = self.acquisition.make_tf_array(free_vars)
AttributeError: '_AcquisitionBinaryOperatorTest' object has no attribute 'acquisition'

======================================================================
ERROR: test_data_update (testing.test_acquisition._AcquisitionBinaryOperatorTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/reinier/GPflowOpt/testing/test_acquisition.py", line 62, in test_data_update
    X = np.vstack((self.acquisition.data[0], design.generate()))
AttributeError: '_AcquisitionBinaryOperatorTest' object has no attribute 'acquisition'

======================================================================
ERROR: test_object_integrity (testing.test_acquisition._AcquisitionBinaryOperatorTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/reinier/GPflowOpt/testing/test_acquisition.py", line 131, in test_object_integrity
    self.assertTrue(isinstance(self.acquisition.lhs, GPflowOpt.acquisition.Acquisition),
AttributeError: '_AcquisitionBinaryOperatorTest' object has no attribute 'acquisition'

======================================================================
ERROR: test_result_shape (testing.test_acquisition._AcquisitionBinaryOperatorTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/reinier/GPflowOpt/testing/test_acquisition.py", line 30, in test_result_shape
    l = self.acquisition.make_tf_array(free_vars)
AttributeError: '_AcquisitionBinaryOperatorTest' object has no attribute 'acquisition'

======================================================================
ERROR: test_data (testing.test_acquisition._AcquisitionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/reinier/GPflowOpt/testing/test_acquisition.py", line 52, in test_data
    l = self.acquisition.make_tf_array(free_vars)
AttributeError: '_AcquisitionTests' object has no attribute 'acquisition'

======================================================================
ERROR: test_data_update (testing.test_acquisition._AcquisitionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/reinier/GPflowOpt/testing/test_acquisition.py", line 62, in test_data_update
    X = np.vstack((self.acquisition.data[0], design.generate()))
AttributeError: '_AcquisitionTests' object has no attribute 'acquisition'

======================================================================
ERROR: test_result_shape (testing.test_acquisition._AcquisitionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/reinier/GPflowOpt/testing/test_acquisition.py", line 30, in test_result_shape
    l = self.acquisition.make_tf_array(free_vars)
AttributeError: '_AcquisitionTests' object has no attribute 'acquisition'

======================================================================
ERROR: test_design_compliance (testing.test_design._DesignTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/reinier/GPflowOpt/testing/test_design.py", line 11, in test_design_compliance
    points = self.design.generate()
AttributeError: '_DesignTests' object has no attribute 'design'

======================================================================
ERROR: test_default_initial (testing.test_optimizers._OptimizerTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/reinier/GPflowOpt/testing/test_optimizers.py", line 33, in test_default_initial
    self.assertTupleEqual(self.optimizer._initial.shape, (1, 2), msg="Invalid shape of initial points array")
AttributeError: '_OptimizerTests' object has no attribute 'optimizer'

======================================================================
ERROR: test_set_initial (testing.test_optimizers._OptimizerTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/reinier/GPflowOpt/testing/test_optimizers.py", line 37, in test_set_initial
    self.optimizer.set_initial([1,1])
AttributeError: '_OptimizerTests' object has no attribute 'optimizer'

----------------------------------------------------------------------
Ran 72 tests in 52.479s

FAILED (errors=10)

@1Reinier
Copy link

1Reinier commented May 2, 2017

@javdrher I could take a look and make some edits next weekend; seems like an easy fix. Just don't have time right now, so if you want to give it a go please do.

@javdrher
Copy link
Member Author

javdrher commented May 2, 2017

Those errors are caused because the unittest driver picks up the test classes with a _ in front of it, which nose ignores. I updated the tests to be more according to https://medium.com/@hakibenita/keeping-tests-dry-with-class-based-tests-in-python-e3f2d815124 so they now work with both ways to invoke tests.

I adjusted the likelihood variance and now the cholesky problems are gone. It has also helped to get rid of part of the overflow errors from transforms, just two tests failing now.
@jameshensman what is your thought on this? I consider updating the data of a GP to be part of GPflow (following https://github.com/GPflow/GPflow/blob/master/doc/source/notebooks/regression_with_updated_data.ipynb). It works, however calling optimize() after a data update tends to return errors from the cholesky decomposition. I tried a few things so far. Increasing the likelihood variance before calling optimize can avoid the problem but it hasn't shown to be very robust. I tested normalization of the output data but it remains troublesome. Is there any way to revert the hypers of a model to more safe settings to restart the optimization? If not I think saving the default state before the first call to optimize and reloading it on each data update might be the most straightforward solution.

@codecov-io
Copy link

codecov-io commented May 5, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@8202f58). Click here to learn what that means.
The diff coverage is 99.18%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master       #4   +/-   ##
=========================================
  Coverage          ?   99.18%           
=========================================
  Files             ?        6           
  Lines             ?      370           
  Branches          ?        0           
=========================================
  Hits              ?      367           
  Misses            ?        3           
  Partials          ?        0
Impacted Files Coverage Δ
GPflowOpt/optim.py 100% <100%> (ø)
GPflowOpt/__init__.py 100% <100%> (ø)
GPflowOpt/acquisition.py 100% <100%> (ø)
GPflowOpt/design.py 96.29% <96.29%> (ø)
GPflowOpt/bo.py 98.14% <98.14%> (ø)
GPflowOpt/domain.py 98.64% <98.64%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8202f58...89316c2. Read the comment docs.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants