mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-30 14:35:15 +02:00
bug fix in progress
This commit is contained in:
parent
84b096d20c
commit
ec64f653b5
3 changed files with 15 additions and 3 deletions
|
|
@ -594,9 +594,10 @@ class Indexable(Nameable, Observable):
|
|||
def tie_vector(self, *plist):
|
||||
"""Tie a vector of parameters to other vectors of parameters"""
|
||||
for p in plist:
|
||||
self._highest_parent_.ties.tie_vector(self,p)
|
||||
self._highest_parent_.ties.tie_vector(self, p)
|
||||
self._highest_parent_._trigger_params_changed()
|
||||
|
||||
|
||||
#===========================================================================
|
||||
# Constrain operations -> done
|
||||
#===========================================================================
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ class Tie(Parameterized):
|
|||
label2 = []
|
||||
self._traverse_param(lambda x: x.tie.flat, (p2,), label2)
|
||||
label2 = np.hstack(label2)
|
||||
expandlist = np.where(label1*label2==0)[0]
|
||||
expandlist = np.where(label1+label2==0)[0]
|
||||
labellist =label1.copy()
|
||||
idx = np.logical_and(label1==0,label2>0)
|
||||
labellist[idx] = label2[idx]
|
||||
|
|
@ -369,8 +369,11 @@ class Tie(Parameterized):
|
|||
self._sync_constraints(plist, toTiedParam)
|
||||
self._update_label_buf()
|
||||
self.update_model(True)
|
||||
|
||||
def tie_vector(self, plist):
|
||||
p_splits = [self._keepParamList([p]) for p in plist]
|
||||
|
||||
def tie_vector(self, p1, p2):
|
||||
def _tie_vector(self, p1, p2):
|
||||
"""tie a pair of vectors"""
|
||||
self.update_model(False)
|
||||
expandlist,removelist,labellist = self._get_labels_vector(p1, p2)
|
||||
|
|
|
|||
|
|
@ -45,6 +45,14 @@ class TieTests(unittest.TestCase):
|
|||
self.assertTrue(m.ties.checkTieVector([m.Z[:2],m.Z[2:4]]))
|
||||
self.assertTrue(m.checkgrad())
|
||||
|
||||
def test_tie_multi_vector(self):
|
||||
m = GPy.examples.dimensionality_reduction.bgplvm_oil(N=100, optimize=False,plot=False)
|
||||
m.X.mean[:1].tie_vector(m.X.mean[1:2], m.X.mean[2:3])
|
||||
self.assertTrue(m.ties.checkValueConsistency())
|
||||
self.assertTrue(m.ties.checkConstraintConsistency())
|
||||
self.assertTrue(m.ties.checkTieVector([m.X.mean[:1],m.X.mean[1:2], m.X.mean[2:3]]))
|
||||
self.assertTrue(m.checkgrad())
|
||||
|
||||
def test_tie_vector_merge(self):
|
||||
m = GPy.examples.regression.sparse_GP_regression_2D(optimize=False, plot=False)
|
||||
m.Z.constrain_positive(warning=False)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue