Ejemplo n.º 1
0
 def test_leaders_single(self):
     # Tests leaders using a flat clustering generated by single linkage.
     X = hierarchy_test_data.Q_X
     Y = pdist(X)
     Z = linkage(Y)
     T = fcluster(Z, criterion='maxclust', t=3)
     Lright = (np.array([53, 55, 56]), np.array([2, 3, 1]))
     L = leaders(Z, T)
     assert_equal(L, Lright)
Ejemplo n.º 2
0
 def test_leaders_single(self):
     # Tests leaders using a flat clustering generated by single linkage.
     X = hierarchy_test_data.Q_X
     Y = pdist(X)
     Z = linkage(Y)
     T = fcluster(Z, criterion='maxclust', t=3)
     Lright = (np.array([53, 55, 56]), np.array([2, 3, 1]))
     L = leaders(Z, T)
     assert_equal(L, Lright)
Ejemplo n.º 3
0
 def check_fcluster_maxclust_monocrit(self, t):
     expectedT = hierarchy_test_data.fcluster_maxclust[t]
     Z = single(hierarchy_test_data.Q_X)
     T = fcluster(Z, t, criterion='maxclust_monocrit', monocrit=maxdists(Z))
     assert_(is_isomorphic(T, expectedT))
Ejemplo n.º 4
0
 def check_fcluster(self, t, criterion):
     # Tests fcluster(Z, criterion=criterion, t=t) on a random 3-cluster data set.
     expectedT = getattr(hierarchy_test_data, 'fcluster_' + criterion)[t]
     Z = single(hierarchy_test_data.Q_X)
     T = fcluster(Z, criterion=criterion, t=t)
     assert_(is_isomorphic(T, expectedT))
Ejemplo n.º 5
0
 def check_fcluster_maxclust_monocrit(self, t):
     expectedT = hierarchy_test_data.fcluster_maxclust[t]
     Z = single(hierarchy_test_data.Q_X)
     T = fcluster(Z, t, criterion='maxclust_monocrit', monocrit=maxdists(Z))
     assert_(is_isomorphic(T, expectedT))
Ejemplo n.º 6
0
 def check_fcluster(self, t, criterion):
     # Tests fcluster(Z, criterion=criterion, t=t) on a random 3-cluster data set.
     expectedT = getattr(hierarchy_test_data, 'fcluster_' + criterion)[t]
     Z = single(hierarchy_test_data.Q_X)
     T = fcluster(Z, criterion=criterion, t=t)
     assert_(is_isomorphic(T, expectedT))