mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-09 03:52:39 +02:00
Import fixes for Py3
This commit is contained in:
parent
5607bd9a19
commit
3faf345969
3 changed files with 5 additions and 2 deletions
|
|
@ -8,6 +8,7 @@ from ...util.linalg import mdot
|
|||
from ...util.decorators import silence_errors
|
||||
from ...core.parameterization.param import Param
|
||||
from ...core.parameterization.transformations import Logexp
|
||||
from functools import reduce
|
||||
|
||||
class Periodic(Kern):
|
||||
def __init__(self, input_dim, variance, lengthscale, period, n_freq, lower, upper, active_dims, name):
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import numpy as np
|
|||
from .kern import CombinationKernel
|
||||
from ...util.caching import Cache_this
|
||||
import itertools
|
||||
from functools import reduce
|
||||
|
||||
class Prod(CombinationKernel):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ except:
|
|||
from numpy.linalg.linalg import LinAlgError
|
||||
from operator import setitem
|
||||
import itertools
|
||||
from functools import reduce
|
||||
|
||||
class PCA(object):
|
||||
"""
|
||||
|
|
@ -47,7 +48,7 @@ class PCA(object):
|
|||
X_ = numpy.ma.masked_array(X, inan)
|
||||
self.mu = X_.mean(0).base
|
||||
self.sigma = X_.std(0).base
|
||||
reduce(lambda y,x: setitem(x[0], x[1], x[2]), itertools.izip(X.T, inan.T, self.mu), None)
|
||||
reduce(lambda y,x: setitem(x[0], x[1], x[2]), zip(X.T, inan.T, self.mu), None)
|
||||
X = X - self.mu
|
||||
X = X / numpy.where(self.sigma == 0, 1e-30, self.sigma)
|
||||
return X
|
||||
|
|
@ -138,4 +139,4 @@ class PCA(object):
|
|||
pylab.tight_layout()
|
||||
except:
|
||||
pass
|
||||
return plots
|
||||
return plots
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue