mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-14 15:25:15 +02:00
Merge branch 'params' of github.com:SheffieldML/GPy into params
Conflicts: GPy/core/parameterization/param.py GPy/core/parameterization/parameter_core.py GPy/core/parameterization/parameterized.py
This commit is contained in:
commit
6a068775f5
10 changed files with 404 additions and 301 deletions
|
|
@ -248,6 +248,16 @@ class Parameterized(Constrainable, Pickleable, Observable):
|
|||
cPickle.dump(self, f, protocol)
|
||||
def copy(self):
|
||||
"""Returns a (deep) copy of the current model """
|
||||
#dc = dict()
|
||||
#for k, v in self.__dict__.iteritems():
|
||||
#if k not in ['_highest_parent_', '_direct_parent_']:
|
||||
#dc[k] = copy.deepcopy(v)
|
||||
|
||||
#dc = copy.deepcopy(self.__dict__)
|
||||
#dc['_highest_parent_'] = None
|
||||
#dc['_direct_parent_'] = None
|
||||
#s = self.__class__.new()
|
||||
#s.__dict__ = dc
|
||||
return copy.deepcopy(self)
|
||||
def __getstate__(self):
|
||||
if self._has_get_set_state():
|
||||
|
|
@ -413,6 +423,8 @@ class Parameterized(Constrainable, Pickleable, Observable):
|
|||
#===========================================================================
|
||||
# Convenience for fixed, tied checking of param:
|
||||
#===========================================================================
|
||||
def fixed_indices(self):
|
||||
return np.array([x.is_fixed for x in self._parameters_])
|
||||
def _is_fixed(self, param):
|
||||
# returns if the whole param is fixed
|
||||
if not self._has_fixes():
|
||||
|
|
@ -442,7 +454,8 @@ class Parameterized(Constrainable, Pickleable, Observable):
|
|||
# if removing constraints before adding new is not wanted, just delete the above line!
|
||||
self.constraints.add(transform, rav_i)
|
||||
param = self._get_original(param)
|
||||
param._set_params(transform.initialize(param._get_params()))
|
||||
if not (transform == __fixed__):
|
||||
param._set_params(transform.initialize(param._get_params()), update=False)
|
||||
if warning and any(reconstrained):
|
||||
# if you want to print the whole params object, which was reconstrained use:
|
||||
# m = str(param[self._backtranslate_index(param, reconstrained)])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue