diff --git a/GPy/core/model.py b/GPy/core/model.py index 58008a99..55083aaf 100644 --- a/GPy/core/model.py +++ b/GPy/core/model.py @@ -154,8 +154,7 @@ class Model(Parameterized): x = np.random.randn(self.size_transformed) x = self._untransform_params(x) # now draw from prior where possible - if self.priors is not None and len(self.priors): - [np.put(x, i, p.rvs(1)) for i, p in enumerate(self.priors) if not p is None] + [np.put(x, ind, p.rvs(ind.size)) for p, ind in self.priors.iteritems() if not p is None] self._set_params(x) # self._set_params_transformed(self._get_params_transformed()) # makes sure all of the tied parameters get the same init (since there's only one prior object...) diff --git a/GPy/core/parameterization/param.py b/GPy/core/parameterization/param.py index a52f2e18..2751bb14 100644 --- a/GPy/core/parameterization/param.py +++ b/GPy/core/parameterization/param.py @@ -145,7 +145,7 @@ class Param(ObservableArray, Constrainable, Gradcheckable, Indexable, Parameteri return new_arr def __setitem__(self, s, val, update=True): super(Param, self).__setitem__(s, val, update=update) - self._notify_tied_parameters() + #self._notify_tied_parameters() if update: self._highest_parent_.parameters_changed() @@ -201,11 +201,11 @@ class Param(ObservableArray, Constrainable, Gradcheckable, Indexable, Parameteri @property def is_fixed(self): return self._highest_parent_._is_fixed(self) - def round(self, decimals=0, out=None): - view = super(Param, self).round(decimals, out).view(Param) - view.__array_finalize__(self) - return view - round.__doc__ = numpy.round.__doc__ + #def round(self, decimals=0, out=None): + # view = super(Param, self).round(decimals, out).view(Param) + # view.__array_finalize__(self) + # return view + #round.__doc__ = numpy.round.__doc__ def _get_original(self, param): return self @@ -337,8 +337,8 @@ class ParamConcatenation(object): def __setitem__(self, s, val, update=True): ind = numpy.zeros(sum(self._param_sizes), dtype=bool); ind[s] = True; vals = self._vals(); vals[s] = val; del val - [numpy.place(p, ind[ps], vals[ps]) and p._notify_tied_parameters() - for p, ps in zip(self.params, self._param_slices_)] + [numpy.place(p, ind[ps], vals[ps])# and p._notify_tied_parameters() + for p, ps in zip(self.params, self._param_slices_)] if update: self.params[0]._highest_parent_.parameters_changed() def _vals(self): diff --git a/GPy/inference/latent_function_inference/laplace.py b/GPy/inference/latent_function_inference/laplace.py index 1b7bdad8..1c524d71 100644 --- a/GPy/inference/latent_function_inference/laplace.py +++ b/GPy/inference/latent_function_inference/laplace.py @@ -216,7 +216,7 @@ class Laplace(object): """ if not log_concave: #print "Under 1e-10: {}".format(np.sum(W < 1e-6)) - W[W < 1e-6] = 1e-6 # FIXME-HACK: This is a hack since GPy can't handle negative variances which can occur + W.__setitem__(W < 1e-6, 1e-6, update=False) # FIXME-HACK: This is a hack since GPy can't handle negative variances which can occur # If the likelihood is non-log-concave. We wan't to say that there is a negative variance # To cause the posterior to become less certain than the prior and likelihood, # This is a property only held by non-log-concave likelihoods