minor changes

This commit is contained in:
Nicolo Fusi 2013-01-31 13:38:05 +00:00
parent d4a539a2d1
commit be8417315c
2 changed files with 4 additions and 4 deletions

View file

@ -132,7 +132,6 @@ class opt_SGD(Optimizer):
self.model.Y = self.model.Y[samples] self.model.Y = self.model.Y[samples]
model_name = self.model.__class__.__name__ model_name = self.model.__class__.__name__
import pdb; pdb.set_trace()
if model_name == 'Bayesian_GPLVM': if model_name == 'Bayesian_GPLVM':
self.model.trYYT = np.sum(np.square(self.model.Y)) self.model.trYYT = np.sum(np.square(self.model.Y))
@ -159,6 +158,7 @@ class opt_SGD(Optimizer):
self.trace = [] self.trace = []
missing_data = self.check_for_missing(self.model.Y) missing_data = self.check_for_missing(self.model.Y)
self.model.Youter = None # this is probably not very efficient self.model.Youter = None # this is probably not very efficient
self.model.YYT = None
for it in range(self.iterations): for it in range(self.iterations):
if it == 0 or self.self_paced is False: if it == 0 or self.self_paced is False:
@ -176,7 +176,7 @@ class opt_SGD(Optimizer):
count += 1 count += 1
self.model.D = len(j) self.model.D = len(j)
self.model.Y = Y[:, j] self.model.Y = Y[:, j]
self.model.trYYT = np.sum(np.square(self.model.Y))
if missing_data: if missing_data:
shapes = self.get_param_shapes(N, Q) shapes = self.get_param_shapes(N, Q)
f, step, Nj = self.step_with_missing_data(f_fp, X, Y, step, shapes) f, step, Nj = self.step_with_missing_data(f_fp, X, Y, step, shapes)

View file

@ -120,7 +120,7 @@ class sparse_GP_regression(GP_regression):
def _get_param_names(self): def _get_param_names(self):
return sum([['iip_%i_%i'%(i,j) for i in range(self.Z.shape[0])] for j in range(self.Z.shape[1])],[]) + ['noise_precision']+self.kern._get_param_names_transformed() return sum([['iip_%i_%i'%(i,j) for i in range(self.Z.shape[0])] for j in range(self.Z.shape[1])],[]) + ['noise_precision']+self.kern._get_param_names_transformed()
def log_likelihood(self): def log_likelihood(self):
""" Compute the (lower bound on the) log marginal likelihood """ """ Compute the (lower bound on the) log marginal likelihood """
sf2 = self.scale_factor**2 sf2 = self.scale_factor**2
@ -132,7 +132,7 @@ class sparse_GP_regression(GP_regression):
def _log_likelihood_gradients(self): def _log_likelihood_gradients(self):
return np.hstack([self.dL_dZ().flatten(), self.dL_dbeta(), self.dL_dtheta()]) return np.hstack([self.dL_dZ().flatten(), self.dL_dbeta(), self.dL_dtheta()])
def dL_dbeta(self): def dL_dbeta(self):
""" """
Compute the gradient of the log likelihood wrt beta. Compute the gradient of the log likelihood wrt beta.