mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-08 19:42:39 +02:00
observer pattern now tested and fully operational. needed the good night rest : )
This commit is contained in:
parent
a35464b32f
commit
999d2419dd
6 changed files with 158 additions and 20 deletions
|
|
@ -116,6 +116,7 @@ class Parameterized(Parameterizable, Pickleable, Gradcheckable):
|
|||
self.constraints.update(param.constraints, start)
|
||||
self.priors.update(param.priors, start)
|
||||
self._parameters_.insert(index, param)
|
||||
param.add_observer(self, self._pass_through_notify, -1)
|
||||
self.size += param.size
|
||||
else:
|
||||
raise RuntimeError, """Parameter exists already added and no copy made"""
|
||||
|
|
@ -169,6 +170,12 @@ class Parameterized(Parameterizable, Pickleable, Gradcheckable):
|
|||
self._param_slices_.append(slice(sizes[-2], sizes[-1]))
|
||||
self._add_parameter_name(p)
|
||||
|
||||
#===========================================================================
|
||||
# notification system
|
||||
#===========================================================================
|
||||
def _pass_through_notify(self, which):
|
||||
self._notify_observers(which)
|
||||
|
||||
#===========================================================================
|
||||
# Pickling operations
|
||||
#===========================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue