mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-03 08:42:39 +02:00
Python 3 fixes
This commit is contained in:
parent
e58cc51c47
commit
e7d1277e62
17 changed files with 52 additions and 48 deletions
|
|
@ -100,10 +100,10 @@ def block_dot(A, B, diagonal=False):
|
|||
Dshape = D.shape
|
||||
if diagonal and (len(Cshape) == 1 or len(Dshape) == 1\
|
||||
or C.shape[0] != C.shape[1] or D.shape[0] != D.shape[1]):
|
||||
print "Broadcasting, C: {} D:{}".format(C.shape, D.shape)
|
||||
print("Broadcasting, C: {} D:{}".format(C.shape, D.shape))
|
||||
return C*D
|
||||
else:
|
||||
print "Dotting, C: {} C:{}".format(C.shape, D.shape)
|
||||
print("Dotting, C: {} C:{}".format(C.shape, D.shape))
|
||||
return np.dot(C,D)
|
||||
dot = np.vectorize(f, otypes = [np.object])
|
||||
return dot(A,B)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import numpy as np
|
|||
from . import linalg
|
||||
from .config import config
|
||||
|
||||
import choleskies_cython
|
||||
from . import choleskies_cython
|
||||
|
||||
def safe_root(N):
|
||||
i = np.sqrt(N)
|
||||
|
|
@ -59,12 +59,12 @@ def _backprop_gradient_pure(dL, L):
|
|||
"""
|
||||
dL_dK = np.tril(dL).copy()
|
||||
N = L.shape[0]
|
||||
for k in xrange(N - 1, -1, -1):
|
||||
for j in xrange(k + 1, N):
|
||||
for i in xrange(j, N):
|
||||
for k in range(N - 1, -1, -1):
|
||||
for j in range(k + 1, N):
|
||||
for i in range(j, N):
|
||||
dL_dK[i, k] -= dL_dK[i, j] * L[j, k]
|
||||
dL_dK[j, k] -= dL_dK[i, j] * L[i, k]
|
||||
for j in xrange(k + 1, N):
|
||||
for j in range(k + 1, N):
|
||||
dL_dK[j, k] /= L[k, k]
|
||||
dL_dK[k, k] -= L[j, k] * dL_dK[j, k]
|
||||
dL_dK[k, k] /= (2 * L[k, k])
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import warnings
|
|||
import os
|
||||
from .config import config
|
||||
import logging
|
||||
import linalg_cython
|
||||
from . import linalg_cython
|
||||
|
||||
|
||||
_scipyversion = np.float64((scipy.__version__).split('.')[:2])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue