Merge branch 'hmc' into devel

A HMC sampler for GP parameters
This commit is contained in:
Zhenwen Dai 2014-08-07 14:30:03 +01:00
commit 98d91e6db2
3 changed files with 177 additions and 0 deletions

View file

@ -862,6 +862,25 @@ class Parameterizable(OptimizationHandlable):
self._param_array_ = np.empty(self.size, dtype=np.float64)
return self._param_array_
@property
def unfixed_param_array(self):
"""
Array representing the parameters of this class.
There is only one copy of all parameters in memory, two during optimization.
!WARNING!: setting the parameter array MUST always be done in memory:
m.param_array[:] = m_copy.param_array
"""
if self.__dict__.get('_param_array_', None) is None:
self._param_array_ = np.empty(self.size, dtype=np.float64)
if self.constraints[__fixed__].size !=0:
fixes = np.ones(self.size).astype(bool)
fixes[self.constraints[__fixed__]] = FIXED
return self._param_array_[fixes]
else:
return self._param_array_
@param_array.setter
def param_array(self, arr):
self._param_array_ = arr