mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-10 20:42:39 +02:00
[logging] more on logging
This commit is contained in:
parent
eb9fb180fb
commit
a9443417d7
3 changed files with 19 additions and 8 deletions
|
|
@ -46,7 +46,7 @@ class SparseGP(GP):
|
||||||
self.num_inducing = Z.shape[0]
|
self.num_inducing = Z.shape[0]
|
||||||
|
|
||||||
GP.__init__(self, X, Y, kernel, likelihood, inference_method=inference_method, name=name, Y_metadata=Y_metadata)
|
GP.__init__(self, X, Y, kernel, likelihood, inference_method=inference_method, name=name, Y_metadata=Y_metadata)
|
||||||
|
self.logger.info("Adding Z as parameter")
|
||||||
self.add_parameter(self.Z, index=0)
|
self.add_parameter(self.Z, index=0)
|
||||||
|
|
||||||
def has_uncertain_inputs(self):
|
def has_uncertain_inputs(self):
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import numpy as np
|
||||||
from ...util.misc import param_to_array
|
from ...util.misc import param_to_array
|
||||||
from . import LatentFunctionInference
|
from . import LatentFunctionInference
|
||||||
log_2_pi = np.log(2*np.pi)
|
log_2_pi = np.log(2*np.pi)
|
||||||
import logging
|
import logging, itertools
|
||||||
logger = logging.getLogger('vardtc')
|
logger = logging.getLogger('vardtc')
|
||||||
|
|
||||||
class VarDTC(LatentFunctionInference):
|
class VarDTC(LatentFunctionInference):
|
||||||
|
|
@ -228,18 +228,28 @@ class VarDTCMissingData(LatentFunctionInference):
|
||||||
self._subarray_indices = []
|
self._subarray_indices = []
|
||||||
csa = common_subarrays(inan, 1)
|
csa = common_subarrays(inan, 1)
|
||||||
size = len(csa)
|
size = len(csa)
|
||||||
|
next_ten = 0
|
||||||
for i, (v,ind) in enumerate(csa.iteritems()):
|
for i, (v,ind) in enumerate(csa.iteritems()):
|
||||||
if not np.all(v):
|
if not np.all(v):
|
||||||
logger.info('preparing subarrays {:3.3%}'.format((i+1.)/size))
|
if ((i+1.)/size) >= next_ten:
|
||||||
|
logger.info('preparing subarrays {:3%}'.format((i+1.)/size))
|
||||||
|
next_ten += max(.1, 1./size)
|
||||||
v = ~np.array(v, dtype=bool)
|
v = ~np.array(v, dtype=bool)
|
||||||
ind = np.array(ind, dtype=int)
|
ind = np.array(ind, dtype=int)
|
||||||
if ind.size == Y.shape[1]:
|
if ind.size == Y.shape[1]:
|
||||||
ind = slice(None)
|
ind = slice(None)
|
||||||
self._subarray_indices.append([v,ind])
|
self._subarray_indices.append([v,ind])
|
||||||
logger.info('preparing subarrays Y')
|
#logger.info('preparing subarrays {:3.3%}'.format((i+1.)/size))
|
||||||
#Ys = [Y[v, :][:, ind] for v, ind in self._subarray_indices]
|
#Ys = [Y[v, :][:, ind] for v, ind in self._subarray_indices]
|
||||||
logger.info('preparing traces Y')
|
logger.info('preparing traces Y')
|
||||||
|
|
||||||
|
next_ten = [0.]
|
||||||
|
count = itertools.count()
|
||||||
def trace(y, v, ind):
|
def trace(y, v, ind):
|
||||||
|
i = count.next()
|
||||||
|
if ((i+1.)/size) >= next_ten[0]:
|
||||||
|
logger.info('preparing traces {:3%}'.format((i+1.)/size))
|
||||||
|
next_ten[0] += .1
|
||||||
y = y[v,:][:,ind]
|
y = y[v,:][:,ind]
|
||||||
return np.einsum('ij,ij->', y,y)
|
return np.einsum('ij,ij->', y,y)
|
||||||
traces = [trace(Y, v, ind) for v, ind in self._subarray_indices]
|
traces = [trace(Y, v, ind) for v, ind in self._subarray_indices]
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ class BayesianGPLVM(SparseGP):
|
||||||
inference_method = VarDTC()
|
inference_method = VarDTC()
|
||||||
|
|
||||||
SparseGP.__init__(self, X, Y, Z, kernel, likelihood, inference_method, name, **kwargs)
|
SparseGP.__init__(self, X, Y, Z, kernel, likelihood, inference_method, name, **kwargs)
|
||||||
|
self.logger.info("Adding X as parameter")
|
||||||
self.add_parameter(self.X, index=0)
|
self.add_parameter(self.X, index=0)
|
||||||
|
|
||||||
def set_X_gradients(self, X, X_grad):
|
def set_X_gradients(self, X, X_grad):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue