mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-10 20:42:39 +02:00
mrd corrections
This commit is contained in:
parent
06ad627f0a
commit
347e2e7fb0
2 changed files with 18 additions and 15 deletions
|
|
@ -188,17 +188,17 @@ class Parameterized(object):
|
||||||
else:
|
else:
|
||||||
self.fixed_indices, self.fixed_values = [], []
|
self.fixed_indices, self.fixed_values = [], []
|
||||||
|
|
||||||
def constrain_negative(self, regexp):
|
def constrain_negative(self, regexp, warning=True):
|
||||||
""" Set negative constraints. """
|
""" Set negative constraints. """
|
||||||
self.constrain(regexp, transformations.negative_logexp())
|
self.constrain(regexp, transformations.negative_logexp(), warning=warning)
|
||||||
|
|
||||||
def constrain_positive(self, regexp):
|
def constrain_positive(self, regexp, warning=True):
|
||||||
""" Set positive constraints. """
|
""" Set positive constraints. """
|
||||||
self.constrain(regexp, transformations.logexp())
|
self.constrain(regexp, transformations.logexp(), warning=warning)
|
||||||
|
|
||||||
def constrain_bounded(self, regexp, lower, upper):
|
def constrain_bounded(self, regexp, lower, upper, warning=True):
|
||||||
""" Set bounded constraints. """
|
""" Set bounded constraints. """
|
||||||
self.constrain(regexp, transformations.logistic(lower, upper))
|
self.constrain(regexp, transformations.logistic(lower, upper), warning=warning)
|
||||||
|
|
||||||
def all_constrained_indices(self):
|
def all_constrained_indices(self):
|
||||||
if len(self.constrained_indices) or len(self.fixed_indices):
|
if len(self.constrained_indices) or len(self.fixed_indices):
|
||||||
|
|
@ -206,10 +206,11 @@ class Parameterized(object):
|
||||||
else:
|
else:
|
||||||
return np.empty(shape=(0,))
|
return np.empty(shape=(0,))
|
||||||
|
|
||||||
def constrain(self, regexp, transform):
|
def constrain(self, regexp, transform, warning=True):
|
||||||
assert isinstance(transform, transformations.transformation)
|
assert isinstance(transform, transformations.transformation)
|
||||||
|
|
||||||
matches = self.grep_param_names(regexp)
|
matches = self.grep_param_names(regexp)
|
||||||
|
if warning:
|
||||||
overlap = set(matches).intersection(set(self.all_constrained_indices()))
|
overlap = set(matches).intersection(set(self.all_constrained_indices()))
|
||||||
if overlap:
|
if overlap:
|
||||||
self.unconstrain(np.asarray(list(overlap)))
|
self.unconstrain(np.asarray(list(overlap)))
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,9 @@ class MRD(Model):
|
||||||
initz='permute', _debug=False, **kw):
|
initz='permute', _debug=False, **kw):
|
||||||
if names is None:
|
if names is None:
|
||||||
self.names = ["{}".format(i) for i in range(len(likelihood_or_Y_list))]
|
self.names = ["{}".format(i) for i in range(len(likelihood_or_Y_list))]
|
||||||
|
else:
|
||||||
|
self.names = names
|
||||||
|
assert len(names) == len(likelihood_or_Y_list), "one name per data set required"
|
||||||
# sort out the kernels
|
# sort out the kernels
|
||||||
if kernels is None:
|
if kernels is None:
|
||||||
kernels = [None] * len(likelihood_or_Y_list)
|
kernels = [None] * len(likelihood_or_Y_list)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue