mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-08 15:05:15 +02:00
separated out untransform_params, enabling flexibility downstream
This commit is contained in:
parent
f69dda71ea
commit
cd6cc9b9b9
1 changed files with 13 additions and 1 deletions
|
|
@ -251,7 +251,18 @@ class parameterised(object):
|
||||||
|
|
||||||
def _set_params_transformed(self, x):
|
def _set_params_transformed(self, x):
|
||||||
""" takes the vector x, which is then modified (by untying, reparameterising or inserting fixed values), and then call self._set_params"""
|
""" takes the vector x, which is then modified (by untying, reparameterising or inserting fixed values), and then call self._set_params"""
|
||||||
|
self._set_params(self._untransform_params(x))
|
||||||
|
|
||||||
|
def _untransform_params(self,x):
|
||||||
|
"""
|
||||||
|
The transformation required for _set_params_transformed.
|
||||||
|
|
||||||
|
This moves the vector x seen by the optimiser (unconstrained) to the
|
||||||
|
valid parameter vector seen by the model
|
||||||
|
|
||||||
|
Note:
|
||||||
|
- This function is separate from _set_params_transformed for downstream flexibility
|
||||||
|
"""
|
||||||
# work out how many places are fixed, and where they are. tricky logic!
|
# work out how many places are fixed, and where they are. tricky logic!
|
||||||
fix_places = self.fixed_indices + [t[1:] for t in self.tied_indices]
|
fix_places = self.fixed_indices + [t[1:] for t in self.tied_indices]
|
||||||
if len(fix_places):
|
if len(fix_places):
|
||||||
|
|
@ -272,7 +283,8 @@ class parameterised(object):
|
||||||
[np.put(xx,i,t.f(xx[i])) for i,t in zip(self.constrained_indices, self.constraints)]
|
[np.put(xx,i,t.f(xx[i])) for i,t in zip(self.constrained_indices, self.constraints)]
|
||||||
if hasattr(self,'debug'):
|
if hasattr(self,'debug'):
|
||||||
stop
|
stop
|
||||||
self._set_params(xx)
|
|
||||||
|
return xx
|
||||||
|
|
||||||
def _get_param_names_transformed(self):
|
def _get_param_names_transformed(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue