mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-18 13:55:14 +02:00
Constrain fixed now unconstrains first
This commit is contained in:
parent
903e66486d
commit
a9d4006488
1 changed files with 9 additions and 1 deletions
|
|
@ -223,7 +223,15 @@ class parameterised(object):
|
||||||
To fix multiple parameters to the same value, simply pass a regular expression which matches both parameter names, or pass both of the indexes
|
To fix multiple parameters to the same value, simply pass a regular expression which matches both parameter names, or pass both of the indexes
|
||||||
"""
|
"""
|
||||||
matches = self.grep_param_names(regexp)
|
matches = self.grep_param_names(regexp)
|
||||||
assert not np.any(matches[:, None] == self.all_constrained_indices()), "Some indices are already constrained"
|
|
||||||
|
overlap = set(matches).intersection(set(self.all_constrained_indices()))
|
||||||
|
if overlap:
|
||||||
|
self.unconstrain(np.asarray(list(overlap)))
|
||||||
|
print 'Warning: re-constraining these parameters'
|
||||||
|
pn = self._get_param_names()
|
||||||
|
for i in overlap:
|
||||||
|
print pn[i]
|
||||||
|
|
||||||
self.fixed_indices.append(matches)
|
self.fixed_indices.append(matches)
|
||||||
if value != None:
|
if value != None:
|
||||||
self.fixed_values.append(value)
|
self.fixed_values.append(value)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue