From 19e9c9e7358f8deb14c2947955bc5fc0e3c3a1cf Mon Sep 17 00:00:00 2001 From: Mike Croucher Date: Fri, 27 Feb 2015 17:55:58 +0000 Subject: [PATCH] Import fixes for Py3 --- GPy/kern/_src/ODE_UY.py | 4 ++-- GPy/kern/_src/ODE_UYC.py | 4 ++-- GPy/kern/_src/ODE_st.py | 4 ++-- GPy/kern/_src/ODE_t.py | 4 ++-- GPy/kern/_src/add.py | 14 +++++++------- GPy/kern/_src/brownian.py | 2 +- GPy/kern/_src/coregionalize.py | 2 +- GPy/kern/_src/eq_ode2.py | 2 +- GPy/kern/_src/independent_outputs.py | 2 +- GPy/kern/_src/kern.py | 6 +++--- GPy/kern/_src/linear.py | 2 +- GPy/kern/_src/mlp.py | 2 +- GPy/kern/_src/periodic.py | 2 +- GPy/kern/_src/poly.py | 2 +- GPy/kern/_src/prod.py | 2 +- GPy/kern/_src/rbf.py | 6 +++--- GPy/kern/_src/splitKern.py | 2 +- GPy/kern/_src/static.py | 2 +- GPy/kern/_src/stationary.py | 2 +- GPy/kern/_src/symbolic.py | 2 +- GPy/kern/_src/trunclinear.py | 2 +- 21 files changed, 35 insertions(+), 35 deletions(-) diff --git a/GPy/kern/_src/ODE_UY.py b/GPy/kern/_src/ODE_UY.py index eef8609b..9c9b47be 100644 --- a/GPy/kern/_src/ODE_UY.py +++ b/GPy/kern/_src/ODE_UY.py @@ -1,11 +1,11 @@ # Copyright (c) 2013, GPy authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) -from kern import Kern +from .kern import Kern from ...core.parameterization import Param from ...core.parameterization.transformations import Logexp import numpy as np -from independent_outputs import index_to_slices +from .independent_outputs import index_to_slices class ODE_UY(Kern): def __init__(self, input_dim, variance_U=3., variance_Y=1., lengthscale_U=1., lengthscale_Y=1., active_dims=None, name='ode_uy'): diff --git a/GPy/kern/_src/ODE_UYC.py b/GPy/kern/_src/ODE_UYC.py index 4c39a9c9..ff75a328 100644 --- a/GPy/kern/_src/ODE_UYC.py +++ b/GPy/kern/_src/ODE_UYC.py @@ -1,11 +1,11 @@ # Copyright (c) 2013, GPy authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) -from kern import Kern +from .kern import Kern from ...core.parameterization import Param from ...core.parameterization.transformations import Logexp import numpy as np -from independent_outputs import index_to_slices +from .independent_outputs import index_to_slices class ODE_UYC(Kern): def __init__(self, input_dim, variance_U=3., variance_Y=1., lengthscale_U=1., lengthscale_Y=1., ubias =1. ,active_dims=None, name='ode_uyc'): diff --git a/GPy/kern/_src/ODE_st.py b/GPy/kern/_src/ODE_st.py index 1c3b661b..afa46d09 100644 --- a/GPy/kern/_src/ODE_st.py +++ b/GPy/kern/_src/ODE_st.py @@ -1,10 +1,10 @@ # Copyright (c) 2012, GPy authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) -from kern import Kern +from .kern import Kern from ...core.parameterization import Param from ...core.parameterization.transformations import Logexp import numpy as np -from independent_outputs import index_to_slices +from .independent_outputs import index_to_slices class ODE_st(Kern): diff --git a/GPy/kern/_src/ODE_t.py b/GPy/kern/_src/ODE_t.py index 268917ae..80625f51 100644 --- a/GPy/kern/_src/ODE_t.py +++ b/GPy/kern/_src/ODE_t.py @@ -1,8 +1,8 @@ -from kern import Kern +from .kern import Kern from ...core.parameterization import Param from ...core.parameterization.transformations import Logexp import numpy as np -from independent_outputs import index_to_slices +from .independent_outputs import index_to_slices class ODE_t(Kern): diff --git a/GPy/kern/_src/add.py b/GPy/kern/_src/add.py index 0f612f5b..17c0027a 100644 --- a/GPy/kern/_src/add.py +++ b/GPy/kern/_src/add.py @@ -4,7 +4,7 @@ import numpy as np import itertools from ...util.caching import Cache_this -from kern import CombinationKernel +from .kern import CombinationKernel class Add(CombinationKernel): """ @@ -84,10 +84,10 @@ class Add(CombinationKernel): psi2 = reduce(np.add, (p.psi2(Z, variational_posterior) for p in self.parts)) #return psi2 # compute the "cross" terms - from static import White, Bias - from rbf import RBF + from .static import White, Bias + from .rbf import RBF #from rbf_inv import RBFInv - from linear import Linear + from .linear import Linear #ffrom fixed import Fixed for p1, p2 in itertools.combinations(self.parts, 2): @@ -115,7 +115,7 @@ class Add(CombinationKernel): return psi2 def update_gradients_expectations(self, dL_dpsi0, dL_dpsi1, dL_dpsi2, Z, variational_posterior): - from static import White, Bias + from .static import White, Bias for p1 in self.parts: #compute the effective dL_dpsi1. Extra terms appear becaue of the cross terms in psi2! eff_dL_dpsi1 = dL_dpsi1.copy() @@ -131,7 +131,7 @@ class Add(CombinationKernel): p1.update_gradients_expectations(dL_dpsi0, eff_dL_dpsi1, dL_dpsi2, Z, variational_posterior) def gradients_Z_expectations(self, dL_psi0, dL_dpsi1, dL_dpsi2, Z, variational_posterior): - from static import White, Bias + from .static import White, Bias target = np.zeros(Z.shape) for p1 in self.parts: #compute the effective dL_dpsi1. extra terms appear becaue of the cross terms in psi2! @@ -149,7 +149,7 @@ class Add(CombinationKernel): return target def gradients_qX_expectations(self, dL_dpsi0, dL_dpsi1, dL_dpsi2, Z, variational_posterior): - from static import White, Bias + from .static import White, Bias target_grads = [np.zeros(v.shape) for v in variational_posterior.parameters] for p1 in self.parameters: #compute the effective dL_dpsi1. extra terms appear becaue of the cross terms in psi2! diff --git a/GPy/kern/_src/brownian.py b/GPy/kern/_src/brownian.py index fd79973c..d403fce7 100644 --- a/GPy/kern/_src/brownian.py +++ b/GPy/kern/_src/brownian.py @@ -1,7 +1,7 @@ # Copyright (c) 2012, GPy authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) -from kern import Kern +from .kern import Kern from ...core.parameterization import Param from ...core.parameterization.transformations import Logexp import numpy as np diff --git a/GPy/kern/_src/coregionalize.py b/GPy/kern/_src/coregionalize.py index b6a3aecf..d76dde1f 100644 --- a/GPy/kern/_src/coregionalize.py +++ b/GPy/kern/_src/coregionalize.py @@ -1,7 +1,7 @@ # Copyright (c) 2012, James Hensman and Ricardo Andrade # Licensed under the BSD 3-clause license (see LICENSE.txt) -from kern import Kern +from .kern import Kern import numpy as np from scipy import weave from ...core.parameterization import Param diff --git a/GPy/kern/_src/eq_ode2.py b/GPy/kern/_src/eq_ode2.py index 59f67b8b..2d42a3e6 100644 --- a/GPy/kern/_src/eq_ode2.py +++ b/GPy/kern/_src/eq_ode2.py @@ -3,7 +3,7 @@ import numpy as np from scipy.special import wofz -from kern import Kern +from .kern import Kern from ...core.parameterization import Param from ...core.parameterization.transformations import Logexp from ...util.caching import Cache_this diff --git a/GPy/kern/_src/independent_outputs.py b/GPy/kern/_src/independent_outputs.py index 21958267..10681d57 100644 --- a/GPy/kern/_src/independent_outputs.py +++ b/GPy/kern/_src/independent_outputs.py @@ -2,7 +2,7 @@ # Licensed under the BSD 3-clause license (see LICENSE.txt) -from kern import Kern, CombinationKernel +from .kern import Kern, CombinationKernel import numpy as np import itertools diff --git a/GPy/kern/_src/kern.py b/GPy/kern/_src/kern.py index 57b2bff5..c4fadd57 100644 --- a/GPy/kern/_src/kern.py +++ b/GPy/kern/_src/kern.py @@ -4,7 +4,7 @@ import sys import numpy as np from ...core.parameterization.parameterized import Parameterized -from kernel_slice_operations import KernCallsViaSlicerMeta +from .kernel_slice_operations import KernCallsViaSlicerMeta from ...util.caching import Cache_this from GPy.core.parameterization.observable_array import ObsAr @@ -178,7 +178,7 @@ class Kern(Parameterized): """ assert isinstance(other, Kern), "only kernels can be added to kernels..." - from add import Add + from .add import Add return Add([self, other], name=name) def __mul__(self, other): @@ -210,7 +210,7 @@ class Kern(Parameterized): """ assert isinstance(other, Kern), "only kernels can be multiplied to kernels..." - from prod import Prod + from .prod import Prod #kernels = [] #if isinstance(self, Prod): kernels.extend(self.parameters) #else: kernels.append(self) diff --git a/GPy/kern/_src/linear.py b/GPy/kern/_src/linear.py index 9d1a956b..e3a45c67 100644 --- a/GPy/kern/_src/linear.py +++ b/GPy/kern/_src/linear.py @@ -3,7 +3,7 @@ import numpy as np -from kern import Kern +from .kern import Kern from ...util.linalg import tdot from ...core.parameterization import Param from ...core.parameterization.transformations import Logexp diff --git a/GPy/kern/_src/mlp.py b/GPy/kern/_src/mlp.py index 16e84363..4488ea82 100644 --- a/GPy/kern/_src/mlp.py +++ b/GPy/kern/_src/mlp.py @@ -1,7 +1,7 @@ # Copyright (c) 2013, GPy authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) -from kern import Kern +from .kern import Kern from ...core.parameterization import Param from ...core.parameterization.transformations import Logexp import numpy as np diff --git a/GPy/kern/_src/periodic.py b/GPy/kern/_src/periodic.py index e8e16506..36fcb596 100644 --- a/GPy/kern/_src/periodic.py +++ b/GPy/kern/_src/periodic.py @@ -3,7 +3,7 @@ import numpy as np -from kern import Kern +from .kern import Kern from ...util.linalg import mdot from ...util.decorators import silence_errors from ...core.parameterization.param import Param diff --git a/GPy/kern/_src/poly.py b/GPy/kern/_src/poly.py index b90e8f8f..a5306c2a 100644 --- a/GPy/kern/_src/poly.py +++ b/GPy/kern/_src/poly.py @@ -2,7 +2,7 @@ # Licensed under the BSD 3-clause license (see LICENSE.txt) import numpy as np -from kern import Kern +from .kern import Kern from ...core.parameterization import Param from ...core.parameterization.transformations import Logexp class Poly(Kern): diff --git a/GPy/kern/_src/prod.py b/GPy/kern/_src/prod.py index bff6d841..84bd1e1d 100644 --- a/GPy/kern/_src/prod.py +++ b/GPy/kern/_src/prod.py @@ -2,7 +2,7 @@ # Licensed under the BSD 3-clause license (see LICENSE.txt) import numpy as np -from kern import CombinationKernel +from .kern import CombinationKernel from ...util.caching import Cache_this import itertools diff --git a/GPy/kern/_src/rbf.py b/GPy/kern/_src/rbf.py index 0c6a4aef..c6998370 100644 --- a/GPy/kern/_src/rbf.py +++ b/GPy/kern/_src/rbf.py @@ -3,9 +3,9 @@ import numpy as np -from stationary import Stationary -from psi_comp import PSICOMP_RBF -from psi_comp.rbf_psi_gpucomp import PSICOMP_RBF_GPU +from .stationary import Stationary +from .psi_comp import PSICOMP_RBF +from .psi_comp.rbf_psi_gpucomp import PSICOMP_RBF_GPU from ...util.config import * class RBF(Stationary): diff --git a/GPy/kern/_src/splitKern.py b/GPy/kern/_src/splitKern.py index 27e4f76b..18771cb0 100644 --- a/GPy/kern/_src/splitKern.py +++ b/GPy/kern/_src/splitKern.py @@ -3,7 +3,7 @@ A new kernel """ import numpy as np -from kern import Kern,CombinationKernel +from .kern import Kern,CombinationKernel from .independent_outputs import index_to_slices import itertools diff --git a/GPy/kern/_src/static.py b/GPy/kern/_src/static.py index f4223bf4..77e395fd 100644 --- a/GPy/kern/_src/static.py +++ b/GPy/kern/_src/static.py @@ -2,7 +2,7 @@ # Licensed under the BSD 3-clause license (see LICENSE.txt) -from kern import Kern +from .kern import Kern import numpy as np from ...core.parameterization import Param from ...core.parameterization.transformations import Logexp diff --git a/GPy/kern/_src/stationary.py b/GPy/kern/_src/stationary.py index 0cd85b38..5052b7b0 100644 --- a/GPy/kern/_src/stationary.py +++ b/GPy/kern/_src/stationary.py @@ -2,7 +2,7 @@ # Licensed under the BSD 3-clause license (see LICENSE.txt) -from kern import Kern +from .kern import Kern from ...core.parameterization import Param from ...core.parameterization.transformations import Logexp from ...util.linalg import tdot diff --git a/GPy/kern/_src/symbolic.py b/GPy/kern/_src/symbolic.py index 9ca20ea5..c339893a 100644 --- a/GPy/kern/_src/symbolic.py +++ b/GPy/kern/_src/symbolic.py @@ -1,7 +1,7 @@ # Check Matthew Rocklin's blog post. import sympy as sym import numpy as np -from kern import Kern +from .kern import Kern from ...core.symbolic import Symbolic_core diff --git a/GPy/kern/_src/trunclinear.py b/GPy/kern/_src/trunclinear.py index 4ebd51b6..8c48f134 100644 --- a/GPy/kern/_src/trunclinear.py +++ b/GPy/kern/_src/trunclinear.py @@ -3,7 +3,7 @@ import numpy as np -from kern import Kern +from .kern import Kern from ...core.parameterization import Param from ...core.parameterization.transformations import Logexp from ...util.caching import Cache_this