Import fixes for Py3

This commit is contained in:
Mike Croucher 2015-02-27 17:55:58 +00:00
parent e07d554cb5
commit 19e9c9e735
21 changed files with 35 additions and 35 deletions

View file

@ -1,11 +1,11 @@
# Copyright (c) 2013, GPy authors (see AUTHORS.txt). # Copyright (c) 2013, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.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 import Param
from ...core.parameterization.transformations import Logexp from ...core.parameterization.transformations import Logexp
import numpy as np import numpy as np
from independent_outputs import index_to_slices from .independent_outputs import index_to_slices
class ODE_UY(Kern): 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'): def __init__(self, input_dim, variance_U=3., variance_Y=1., lengthscale_U=1., lengthscale_Y=1., active_dims=None, name='ode_uy'):

View file

@ -1,11 +1,11 @@
# Copyright (c) 2013, GPy authors (see AUTHORS.txt). # Copyright (c) 2013, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.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 import Param
from ...core.parameterization.transformations import Logexp from ...core.parameterization.transformations import Logexp
import numpy as np import numpy as np
from independent_outputs import index_to_slices from .independent_outputs import index_to_slices
class ODE_UYC(Kern): 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'): 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'):

View file

@ -1,10 +1,10 @@
# Copyright (c) 2012, GPy authors (see AUTHORS.txt). # Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.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 import Param
from ...core.parameterization.transformations import Logexp from ...core.parameterization.transformations import Logexp
import numpy as np import numpy as np
from independent_outputs import index_to_slices from .independent_outputs import index_to_slices
class ODE_st(Kern): class ODE_st(Kern):

View file

@ -1,8 +1,8 @@
from kern import Kern from .kern import Kern
from ...core.parameterization import Param from ...core.parameterization import Param
from ...core.parameterization.transformations import Logexp from ...core.parameterization.transformations import Logexp
import numpy as np import numpy as np
from independent_outputs import index_to_slices from .independent_outputs import index_to_slices
class ODE_t(Kern): class ODE_t(Kern):

View file

@ -4,7 +4,7 @@
import numpy as np import numpy as np
import itertools import itertools
from ...util.caching import Cache_this from ...util.caching import Cache_this
from kern import CombinationKernel from .kern import CombinationKernel
class Add(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)) psi2 = reduce(np.add, (p.psi2(Z, variational_posterior) for p in self.parts))
#return psi2 #return psi2
# compute the "cross" terms # compute the "cross" terms
from static import White, Bias from .static import White, Bias
from rbf import RBF from .rbf import RBF
#from rbf_inv import RBFInv #from rbf_inv import RBFInv
from linear import Linear from .linear import Linear
#ffrom fixed import Fixed #ffrom fixed import Fixed
for p1, p2 in itertools.combinations(self.parts, 2): for p1, p2 in itertools.combinations(self.parts, 2):
@ -115,7 +115,7 @@ class Add(CombinationKernel):
return psi2 return psi2
def update_gradients_expectations(self, dL_dpsi0, dL_dpsi1, dL_dpsi2, Z, variational_posterior): 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: for p1 in self.parts:
#compute the effective dL_dpsi1. Extra terms appear becaue of the cross terms in psi2! #compute the effective dL_dpsi1. Extra terms appear becaue of the cross terms in psi2!
eff_dL_dpsi1 = dL_dpsi1.copy() 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) 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): 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) target = np.zeros(Z.shape)
for p1 in self.parts: for p1 in self.parts:
#compute the effective dL_dpsi1. extra terms appear becaue of the cross terms in psi2! #compute the effective dL_dpsi1. extra terms appear becaue of the cross terms in psi2!
@ -149,7 +149,7 @@ class Add(CombinationKernel):
return target return target
def gradients_qX_expectations(self, dL_dpsi0, dL_dpsi1, dL_dpsi2, Z, variational_posterior): 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] target_grads = [np.zeros(v.shape) for v in variational_posterior.parameters]
for p1 in self.parameters: for p1 in self.parameters:
#compute the effective dL_dpsi1. extra terms appear becaue of the cross terms in psi2! #compute the effective dL_dpsi1. extra terms appear becaue of the cross terms in psi2!

View file

@ -1,7 +1,7 @@
# Copyright (c) 2012, GPy authors (see AUTHORS.txt). # Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.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 import Param
from ...core.parameterization.transformations import Logexp from ...core.parameterization.transformations import Logexp
import numpy as np import numpy as np

View file

@ -1,7 +1,7 @@
# Copyright (c) 2012, James Hensman and Ricardo Andrade # Copyright (c) 2012, James Hensman and Ricardo Andrade
# Licensed under the BSD 3-clause license (see LICENSE.txt) # Licensed under the BSD 3-clause license (see LICENSE.txt)
from kern import Kern from .kern import Kern
import numpy as np import numpy as np
from scipy import weave from scipy import weave
from ...core.parameterization import Param from ...core.parameterization import Param

View file

@ -3,7 +3,7 @@
import numpy as np import numpy as np
from scipy.special import wofz from scipy.special import wofz
from kern import Kern from .kern import Kern
from ...core.parameterization import Param from ...core.parameterization import Param
from ...core.parameterization.transformations import Logexp from ...core.parameterization.transformations import Logexp
from ...util.caching import Cache_this from ...util.caching import Cache_this

View file

@ -2,7 +2,7 @@
# Licensed under the BSD 3-clause license (see LICENSE.txt) # 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 numpy as np
import itertools import itertools

View file

@ -4,7 +4,7 @@
import sys import sys
import numpy as np import numpy as np
from ...core.parameterization.parameterized import Parameterized 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 ...util.caching import Cache_this
from GPy.core.parameterization.observable_array import ObsAr 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..." 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) return Add([self, other], name=name)
def __mul__(self, other): def __mul__(self, other):
@ -210,7 +210,7 @@ class Kern(Parameterized):
""" """
assert isinstance(other, Kern), "only kernels can be multiplied to kernels..." assert isinstance(other, Kern), "only kernels can be multiplied to kernels..."
from prod import Prod from .prod import Prod
#kernels = [] #kernels = []
#if isinstance(self, Prod): kernels.extend(self.parameters) #if isinstance(self, Prod): kernels.extend(self.parameters)
#else: kernels.append(self) #else: kernels.append(self)

View file

@ -3,7 +3,7 @@
import numpy as np import numpy as np
from kern import Kern from .kern import Kern
from ...util.linalg import tdot from ...util.linalg import tdot
from ...core.parameterization import Param from ...core.parameterization import Param
from ...core.parameterization.transformations import Logexp from ...core.parameterization.transformations import Logexp

View file

@ -1,7 +1,7 @@
# Copyright (c) 2013, GPy authors (see AUTHORS.txt). # Copyright (c) 2013, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.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 import Param
from ...core.parameterization.transformations import Logexp from ...core.parameterization.transformations import Logexp
import numpy as np import numpy as np

View file

@ -3,7 +3,7 @@
import numpy as np import numpy as np
from kern import Kern from .kern import Kern
from ...util.linalg import mdot from ...util.linalg import mdot
from ...util.decorators import silence_errors from ...util.decorators import silence_errors
from ...core.parameterization.param import Param from ...core.parameterization.param import Param

View file

@ -2,7 +2,7 @@
# Licensed under the BSD 3-clause license (see LICENSE.txt) # Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np import numpy as np
from kern import Kern from .kern import Kern
from ...core.parameterization import Param from ...core.parameterization import Param
from ...core.parameterization.transformations import Logexp from ...core.parameterization.transformations import Logexp
class Poly(Kern): class Poly(Kern):

View file

@ -2,7 +2,7 @@
# Licensed under the BSD 3-clause license (see LICENSE.txt) # Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np import numpy as np
from kern import CombinationKernel from .kern import CombinationKernel
from ...util.caching import Cache_this from ...util.caching import Cache_this
import itertools import itertools

View file

@ -3,9 +3,9 @@
import numpy as np import numpy as np
from stationary import Stationary from .stationary import Stationary
from psi_comp import PSICOMP_RBF from .psi_comp import PSICOMP_RBF
from psi_comp.rbf_psi_gpucomp import PSICOMP_RBF_GPU from .psi_comp.rbf_psi_gpucomp import PSICOMP_RBF_GPU
from ...util.config import * from ...util.config import *
class RBF(Stationary): class RBF(Stationary):

View file

@ -3,7 +3,7 @@ A new kernel
""" """
import numpy as np import numpy as np
from kern import Kern,CombinationKernel from .kern import Kern,CombinationKernel
from .independent_outputs import index_to_slices from .independent_outputs import index_to_slices
import itertools import itertools

View file

@ -2,7 +2,7 @@
# Licensed under the BSD 3-clause license (see LICENSE.txt) # Licensed under the BSD 3-clause license (see LICENSE.txt)
from kern import Kern from .kern import Kern
import numpy as np import numpy as np
from ...core.parameterization import Param from ...core.parameterization import Param
from ...core.parameterization.transformations import Logexp from ...core.parameterization.transformations import Logexp

View file

@ -2,7 +2,7 @@
# Licensed under the BSD 3-clause license (see LICENSE.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 import Param
from ...core.parameterization.transformations import Logexp from ...core.parameterization.transformations import Logexp
from ...util.linalg import tdot from ...util.linalg import tdot

View file

@ -1,7 +1,7 @@
# Check Matthew Rocklin's blog post. # Check Matthew Rocklin's blog post.
import sympy as sym import sympy as sym
import numpy as np import numpy as np
from kern import Kern from .kern import Kern
from ...core.symbolic import Symbolic_core from ...core.symbolic import Symbolic_core

View file

@ -3,7 +3,7 @@
import numpy as np import numpy as np
from kern import Kern from .kern import Kern
from ...core.parameterization import Param from ...core.parameterization import Param
from ...core.parameterization.transformations import Logexp from ...core.parameterization.transformations import Logexp
from ...util.caching import Cache_this from ...util.caching import Cache_this