mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-10 12:32:40 +02:00
Moved fix parameter to constrainable
This commit is contained in:
parent
d2a0e4a265
commit
c6d466e72d
2 changed files with 21 additions and 17 deletions
|
|
@ -158,23 +158,6 @@ class Param(ObservableArray, Constrainable):
|
||||||
def _collect_gradient(self, target):
|
def _collect_gradient(self, target):
|
||||||
target[:] = self.gradient.flat
|
target[:] = self.gradient.flat
|
||||||
#===========================================================================
|
#===========================================================================
|
||||||
# Fixing Parameters:
|
|
||||||
#===========================================================================
|
|
||||||
def constrain_fixed(self, warning=True):
|
|
||||||
"""
|
|
||||||
Constrain this paramter to be fixed to the current value it carries.
|
|
||||||
|
|
||||||
:param warning: print a warning for overwriting constraints.
|
|
||||||
"""
|
|
||||||
self._highest_parent_._fix(self,warning)
|
|
||||||
fix = constrain_fixed
|
|
||||||
def unconstrain_fixed(self):
|
|
||||||
"""
|
|
||||||
This parameter will no longer be fixed.
|
|
||||||
"""
|
|
||||||
self._highest_parent_._unfix(self)
|
|
||||||
unfix = unconstrain_fixed
|
|
||||||
#===========================================================================
|
|
||||||
# Tying operations -> bugged, TODO
|
# Tying operations -> bugged, TODO
|
||||||
#===========================================================================
|
#===========================================================================
|
||||||
def tie_to(self, param):
|
def tie_to(self, param):
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,27 @@ class Nameable(Parentable):
|
||||||
class Constrainable(Nameable):
|
class Constrainable(Nameable):
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
super(Constrainable,self).__init__(name)
|
super(Constrainable,self).__init__(name)
|
||||||
|
#===========================================================================
|
||||||
|
# Fixing Parameters:
|
||||||
|
#===========================================================================
|
||||||
|
def constrain_fixed(self, value=None, warning=True):
|
||||||
|
"""
|
||||||
|
Constrain this paramter to be fixed to the current value it carries.
|
||||||
|
|
||||||
|
:param warning: print a warning for overwriting constraints.
|
||||||
|
"""
|
||||||
|
if value is not None:
|
||||||
|
self[:] = value
|
||||||
|
self._highest_parent_._fix(self,warning)
|
||||||
|
fix = constrain_fixed
|
||||||
|
def unconstrain_fixed(self):
|
||||||
|
"""
|
||||||
|
This parameter will no longer be fixed.
|
||||||
|
"""
|
||||||
|
self._highest_parent_._unfix(self)
|
||||||
|
unfix = unconstrain_fixed
|
||||||
|
|
||||||
|
|
||||||
#===========================================================================
|
#===========================================================================
|
||||||
# Constrain operations -> done
|
# Constrain operations -> done
|
||||||
#===========================================================================
|
#===========================================================================
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue