diff --git a/GPy/__init__.py b/GPy/__init__.py index 99a91fe8..5e091170 100644 --- a/GPy/__init__.py +++ b/GPy/__init__.py @@ -39,6 +39,11 @@ def load(file_path): :param file_name: path/to/file.pickle """ import cPickle as pickle - with open(file_path, 'rb') as f: - m = pickle.load(f) + try: + with open(file_path, 'rb') as f: + m = pickle.load(f) + except: + import pickle as pickle + with open(file_path, 'rb') as f: + m = pickle.load(f) return m diff --git a/GPy/core/model.py b/GPy/core/model.py index 029b8fc8..ac5a9732 100644 --- a/GPy/core/model.py +++ b/GPy/core/model.py @@ -238,6 +238,10 @@ class Model(Parameterized): if self.size == 0: print 'nothing to optimize' + if not self.update_model(): + print "setting updates on again" + self.update_model(True) + if start == None: start = self.optimizer_array @@ -279,10 +283,10 @@ class Model(Parameterized): Note:- The gradient is considered correct if the ratio of the analytical and numerical gradients is within of unity. - - The *dF_ratio* indicates the limit of numerical accuracy of numerical gradients. - If it is too small, e.g., smaller than 1e-12, the numerical gradients are usually - not accurate enough for the tests (shown with blue). + + The *dF_ratio* indicates the limit of numerical accuracy of numerical gradients. + If it is too small, e.g., smaller than 1e-12, the numerical gradients are usually + not accurate enough for the tests (shown with blue). """ x = self.optimizer_array.copy() diff --git a/GPy/core/parameterization/transformations.py b/GPy/core/parameterization/transformations.py index 01b0f324..291076a1 100644 --- a/GPy/core/parameterization/transformations.py +++ b/GPy/core/parameterization/transformations.py @@ -131,6 +131,13 @@ class NormalTheta(Transformation): def __str__(self): return "theta" + def __getstate__(self): + return [self.mu_indices, self.var_indices] + + def __setstate__(self, state): + self.mu_indices = state[0] + self.var_indices = state[1] + class NormalNaturalAntti(NormalTheta): _instances = [] _logexp = Logexp() diff --git a/GPy/models/bayesian_gplvm_minibatch.py b/GPy/models/bayesian_gplvm_minibatch.py index 5b7d3162..80abba59 100644 --- a/GPy/models/bayesian_gplvm_minibatch.py +++ b/GPy/models/bayesian_gplvm_minibatch.py @@ -54,6 +54,8 @@ class BayesianGPLVMMiniBatch(SparseGPMiniBatch): self.variational_prior = NormalPrior() X = NormalPosterior(X, X_variance) + self.kl_factr = 1. + if inference_method is None: from ..inference.latent_function_inference.var_dtc import VarDTC self.logger.debug("creating inference_method var_dtc") diff --git a/GPy/models/mrd.py b/GPy/models/mrd.py index 91d34aa2..645cdf88 100644 --- a/GPy/models/mrd.py +++ b/GPy/models/mrd.py @@ -100,7 +100,7 @@ class MRD(BayesianGPLVMMiniBatch): self.logger.info("building kernels") if kernel is None: from ..kern import RBF - kernels = [RBF(input_dim, ARD=1, lengthscale=fracs[i]) for i in range(len(Ylist))] + kernels = [RBF(input_dim, ARD=1, lengthscale=1./fracs[i]) for i in range(len(Ylist))] elif isinstance(kernel, Kern): kernels = [] for i in range(len(Ylist)): diff --git a/GPy/plotting/matplot_dep/dim_reduction_plots.py b/GPy/plotting/matplot_dep/dim_reduction_plots.py index 7ec0b59d..25a1166f 100644 --- a/GPy/plotting/matplot_dep/dim_reduction_plots.py +++ b/GPy/plotting/matplot_dep/dim_reduction_plots.py @@ -162,7 +162,7 @@ def plot_latent(model, labels=None, which_indices=None, else: x = X[index, input_1] y = X[index, input_2] - ax.scatter(x, y, marker=m, s=s, c=Tango.nextMedium(), label=this_label, linewidth=.5, edgecolor='k', alpha=.9) + ax.scatter(x, y, marker=m, s=s, c=Tango.nextMedium(), label=this_label, linewidth=.2, edgecolor='k', alpha=.9) ax.set_xlabel('latent dimension %i' % input_1) ax.set_ylabel('latent dimension %i' % input_2)