mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-13 14:03:20 +02:00
copy
This commit is contained in:
parent
abc7545e09
commit
b975a45cd2
1 changed files with 13 additions and 15 deletions
|
|
@ -16,7 +16,7 @@ Observable Pattern for patameterization
|
||||||
from transformations import Transformation, Logexp, NegativeLogexp, Logistic, __fixed__, FIXED, UNFIXED
|
from transformations import Transformation, Logexp, NegativeLogexp, Logistic, __fixed__, FIXED, UNFIXED
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
__updated__ = '2014-03-11'
|
__updated__ = '2014-03-12'
|
||||||
|
|
||||||
class HierarchyError(Exception):
|
class HierarchyError(Exception):
|
||||||
"""
|
"""
|
||||||
|
|
@ -831,16 +831,13 @@ class Parameterizable(OptimizationHandlable):
|
||||||
self._gradient_array_ = np.empty(self.size, dtype=np.float64)
|
self._gradient_array_ = np.empty(self.size, dtype=np.float64)
|
||||||
|
|
||||||
self._param_slices_ = []
|
self._param_slices_ = []
|
||||||
|
|
||||||
for i, p in enumerate(self._parameters_):
|
for i, p in enumerate(self._parameters_):
|
||||||
p._parent_ = self
|
p._parent_ = self
|
||||||
p._parent_index_ = i
|
p._parent_index_ = i
|
||||||
|
|
||||||
pslice = slice(old_size, old_size+p.size)
|
pslice = slice(old_size, old_size+p.size)
|
||||||
|
|
||||||
# first connect all children
|
# first connect all children
|
||||||
p._propagate_param_grad(self._param_array_[pslice], self._gradient_array_[pslice])
|
p._propagate_param_grad(self._param_array_[pslice], self._gradient_array_[pslice])
|
||||||
|
|
||||||
# then connect children to self
|
# then connect children to self
|
||||||
self._param_array_[pslice] = p._param_array_.ravel()#, requirements=['C', 'W']).ravel(order='C')
|
self._param_array_[pslice] = p._param_array_.ravel()#, requirements=['C', 'W']).ravel(order='C')
|
||||||
self._gradient_array_[pslice] = p._gradient_array_.ravel()#, requirements=['C', 'W']).ravel(order='C')
|
self._gradient_array_[pslice] = p._gradient_array_.ravel()#, requirements=['C', 'W']).ravel(order='C')
|
||||||
|
|
@ -868,6 +865,7 @@ class Parameterizable(OptimizationHandlable):
|
||||||
#===========================================================================
|
#===========================================================================
|
||||||
def copy(self):
|
def copy(self):
|
||||||
"""Returns a (deep) copy of the current model"""
|
"""Returns a (deep) copy of the current model"""
|
||||||
|
raise NotImplementedError, "Copy is not yet implemented, TODO: Observable hierarchy"
|
||||||
import copy
|
import copy
|
||||||
from .index_operations import ParameterIndexOperations, ParameterIndexOperationsView
|
from .index_operations import ParameterIndexOperations, ParameterIndexOperationsView
|
||||||
from .lists_and_dicts import ArrayList
|
from .lists_and_dicts import ArrayList
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue