mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-04-29 06:46:22 +02:00
parameterized: added warning switch
This commit is contained in:
parent
347e2e7fb0
commit
50db3a90e9
2 changed files with 12 additions and 11 deletions
|
|
@ -225,7 +225,7 @@ class Parameterized(object):
|
|||
x[matches] = transform.initialize(x[matches])
|
||||
self._set_params(x)
|
||||
|
||||
def constrain_fixed(self, regexp, value=None):
|
||||
def constrain_fixed(self, regexp, value=None, warning=True):
|
||||
"""
|
||||
|
||||
:param regexp: which parameters need to be fixed.
|
||||
|
|
@ -242,13 +242,14 @@ class Parameterized(object):
|
|||
|
||||
"""
|
||||
matches = self.grep_param_names(regexp)
|
||||
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]
|
||||
if warning:
|
||||
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)
|
||||
if value != None:
|
||||
|
|
|
|||
|
|
@ -327,9 +327,9 @@ class MRD(Model):
|
|||
if titles is None:
|
||||
titles = [r'${}$'.format(name) for name in self.names]
|
||||
ymax = reduce(max, [numpy.ceil(max(g.input_sensitivity())) for g in self.bgplvms])
|
||||
def plotf(i, g, ax):
|
||||
ax.set_ylim([0,ymax])
|
||||
g.kern.plot_ARD(ax=ax, title=titles[i], *args, **kwargs)
|
||||
def plotf(i, g, axis):
|
||||
axis.set_ylim([0,ymax])
|
||||
g.kern.plot_ARD(ax=axis, title=titles[i], *args, **kwargs)
|
||||
fig = self._handle_plotting(fignum, ax, plotf, sharex=sharex, sharey=sharey)
|
||||
return fig
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue