UCL-SML / Doubly-Stochastic-DGP

Deep Gaussian Processes with Doubly Stochastic Variational Inference
Apache License 2.0
142 stars 48 forks source link

Cannot import Kuu name #37

Open Mirgahney opened 5 years ago

Mirgahney commented 5 years ago

Hi Hugh,

We I was trying to import deep GP from doubly_stochastic_dgp.dgp import DG I get the following error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-a6c15c619455> in <module>()
     13 from scipy.cluster.vq import kmeans2
     14 
---> 15 from doubly_stochastic_dgp.dgp import DGP
     16 
     17 import time

D:\Users\mar\Anaconda3\lib\site-packages\doubly_stochastic_dgp-1.0-py3.6.egg\doubly_stochastic_dgp\dgp.py in <module>()
     29 
     30 from doubly_stochastic_dgp.utils import BroadcastingLikelihood
---> 31 from doubly_stochastic_dgp.layer_initializations import init_layers_linear
     32 from doubly_stochastic_dgp.layers import GPR_Layer, SGPMC_Layer, GPMC_Layer, SVGP_Layer
     33 

D:\Users\mar\Anaconda3\lib\site-packages\doubly_stochastic_dgp-1.0-py3.6.egg\doubly_stochastic_dgp\layer_initializations.py in <module>()
     12 float_type = settings.float_type
     13 
---> 14 from doubly_stochastic_dgp.layers import SVGP_Layer
     15 
     16 def init_layers_linear(X, Y, Z, kernels,

D:\Users\mar\Anaconda3\lib\site-packages\doubly_stochastic_dgp-1.0-py3.6.egg\doubly_stochastic_dgp\layers.py in <module>()
     18 import gpflow
     19 from gpflow.params import Parameter, Parameterized
---> 20 from gpflow.conditionals import conditional, Kuu
     21 from gpflow.features import InducingPoints
     22 from gpflow.kullback_leiblers import gauss_kl

ImportError: cannot import name 'Kuu'

and I'm using GPflow 1.1.1

hughsalimbeni commented 5 years ago

Hi thanks for pointing this out. The code is not compatible with gpflow1.1. It should work with gpflow1.0, however.

I will try to refactor the code for compatibility with gpflow1.1 later today.

hughsalimbeni commented 5 years ago

I've thought a bit more about this and think it's not worth refactoring right now as tensorflow2 and gpflow2 are very soon to be released. These new version will incur major refactoring, including much simplification (e.g. no autoflow), so I don't think it's worth changing things at this stage. To get the above code to work the Kuu import can be dropped and then the matrix can be created using something likekern.K(Z) + tf.eye(M) * jitter

LanyeHu commented 4 years ago

Hi, I am facing the same problem with gpflow 1.5.0 , tensorflow 1.14.0 and python 3.7 AttributeError: 'InducingPoints' object has no attribute 'Kuu' Tensorflow 1.8 is incompatible for python 3.7. After installing gpflow 1.0 here's another problem from gpflow.training import AdamOptimizer ImportError: cannot import name 'AdamOptimizer' from 'gpflow.training' (/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/gpflow/training/__init__.py)

hughsalimbeni commented 4 years ago

Perhaps try gpflow1.4?

hughsalimbeni commented 4 years ago

Or 1.1

LanyeHu commented 4 years ago

Thanks. I changed the version of gpflow to 1.3.0, tensorflow to 1.13.1 and it works.