mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-30 14:35:15 +02:00
Make symmetric kernel work with python 2.7
This commit is contained in:
parent
1a42cbd342
commit
09c72eeec5
1 changed files with 2 additions and 2 deletions
|
|
@ -38,7 +38,7 @@ class Symmetric(Kern):
|
||||||
|
|
||||||
def __init__(self, base_kernel, transform, symmetry_type='even'):
|
def __init__(self, base_kernel, transform, symmetry_type='even'):
|
||||||
|
|
||||||
super().__init__(1, [0], name='symmetric_kernel')
|
super(Symmetric, self).__init__(1, [0], name='symmetric_kernel')
|
||||||
if symmetry_type is 'odd':
|
if symmetry_type is 'odd':
|
||||||
self.symmetry_sign = -1.
|
self.symmetry_sign = -1.
|
||||||
elif symmetry_type is 'even':
|
elif symmetry_type is 'even':
|
||||||
|
|
@ -77,7 +77,7 @@ class Symmetric(Kern):
|
||||||
# Evaluate cross terms in batches, taking the diag of a larger matrix
|
# Evaluate cross terms in batches, taking the diag of a larger matrix
|
||||||
# is wasteful, but is more efficient than calling kernel.K for each data point
|
# is wasteful, but is more efficient than calling kernel.K for each data point
|
||||||
batch_size = 100
|
batch_size = 100
|
||||||
n_batches = int(np.ceil(n_points / batch_size))
|
n_batches = int(np.ceil(n_points / float(batch_size)))
|
||||||
cross_term = np.zeros(X.shape[0])
|
cross_term = np.zeros(X.shape[0])
|
||||||
for i in range(n_batches):
|
for i in range(n_batches):
|
||||||
i_start = i * batch_size
|
i_start = i * batch_size
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue