diff --git a/GPy/models/Bayesian_GPLVM.py b/GPy/models/Bayesian_GPLVM.py index f2393df8..e7d928ac 100644 --- a/GPy/models/Bayesian_GPLVM.py +++ b/GPy/models/Bayesian_GPLVM.py @@ -87,19 +87,19 @@ class Bayesian_GPLVM(sparse_GP, GPLVM): return x def _set_params(self, x, save_old=True, save_count=0): - try: +# try: N, Q = self.N, self.Q self.X = x[:self.X.size].reshape(N, Q).copy() self.X_variance = x[(N * Q):(2 * N * Q)].reshape(N, Q).copy() sparse_GP._set_params(self, x[(2 * N * Q):]) - self.oldps = x - except (LinAlgError, FloatingPointError, ZeroDivisionError): - print "\rWARNING: Caught LinAlgError, continueing without setting " - if self._debug: - self._savederrors.append(self.f_call) - if save_count > 10: - raise - self._set_params(self.oldps[-1], save_old=False, save_count=save_count + 1) +# self.oldps = x +# except (LinAlgError, FloatingPointError, ZeroDivisionError): +# print "\rWARNING: Caught LinAlgError, continueing without setting " +# if self._debug: +# self._savederrors.append(self.f_call) +# if save_count > 10: +# raise +# self._set_params(self.oldps[-1], save_old=False, save_count=save_count + 1) def dKL_dmuS(self): dKL_dS = (1. - (1. / (self.X_variance))) * 0.5 diff --git a/GPy/models/mrd.py b/GPy/models/mrd.py index 23aa81b3..e79b6720 100644 --- a/GPy/models/mrd.py +++ b/GPy/models/mrd.py @@ -93,7 +93,7 @@ class MRD(model): self.NQ = self.N * self.Q self.MQ = self.M * self.Q - model.__init__(self) # @UndefinedVariable + model.__init__(self) # @UndefinedVariable @property def X(self): @@ -255,7 +255,7 @@ class MRD(model): X[:, qs] = PCA(Y, len(qs))[0] elif init in "PCA_concat": X = PCA(numpy.hstack(Ylist), self.Q)[0] - else: # init == 'random': + else: # init == 'random': X = numpy.random.randn(Ylist[0].shape[0], self.Q) self.X = X return X diff --git a/GPy/util/datasets.py b/GPy/util/datasets.py index ab290dd8..91a02f2d 100644 --- a/GPy/util/datasets.py +++ b/GPy/util/datasets.py @@ -102,9 +102,10 @@ def swiss_roll_1000(): Y = mat_data['X_data'][:, 0:1000].transpose() return {'Y': Y, 'info': "Subsample of the swiss roll data extracting only the first 1000 values."} -def swiss_roll(): +def swiss_roll(N=3000): mat_data = scipy.io.loadmat(os.path.join(data_path, 'swiss_roll_data.mat')) - Y = mat_data['X_data'][:, 0:3000].transpose() + Y = mat_data['X_data'][:, 0:N].transpose() + import ipdb;ipdb.set_trace() return {'Y': Y, 'info': "The first 3,000 points from the swiss roll data of Tennenbaum, de Silva and Langford (2001)."} def toy_rbf_1d(seed=default_seed): @@ -270,13 +271,13 @@ def cmu_mocap(subject, train_motions, test_motions=[], sample_every=4): end_ind = 0 for i in range(len(temp_Y)): - start_ind = end_ind + start_ind = end_ind end_ind += temp_Y[i].shape[0] Y[start_ind:end_ind, :] = temp_Y[i] lbls[start_ind:end_ind, :] = temp_lbls[i] - if len(test_motions)>0: + if len(test_motions) > 0: temp_Ytest = [] - temp_lblstest = [] + temp_lblstest = [] testexlbls = np.eye(len(test_motions)) tot_test_length = 0 @@ -292,7 +293,7 @@ def cmu_mocap(subject, train_motions, test_motions=[], sample_every=4): end_ind = 0 for i in range(len(temp_Ytest)): - start_ind = end_ind + start_ind = end_ind end_ind += temp_Ytest[i].shape[0] Ytest[start_ind:end_ind, :] = temp_Ytest[i] lblstest[start_ind:end_ind, :] = temp_lblstest[i] @@ -304,7 +305,7 @@ def cmu_mocap(subject, train_motions, test_motions=[], sample_every=4): for motion in train_motions: info += motion + ', ' info = info[:-2] - if len(test_motions)>0: + if len(test_motions) > 0: info += '. Test motions: ' for motion in test_motions: info += motion + ', '