def check_maxdists_Q_linkage(self, method): # Tests maxdists(Z) on the Q data set X = hierarchy_test_data.Q_X Z = linkage(X, method) MD = maxdists(Z) expectedMD = calculate_maximum_distances(Z) assert_allclose(MD, expectedMD, atol=1e-15)
def test_maxdists_one_cluster_linkage(self): # Tests maxdists(Z) on linkage with one cluster. Z = np.asarray([[0, 1, 0.3, 4]], dtype=np.double) MD = maxdists(Z) expectedMD = calculate_maximum_distances(Z) assert_allclose(MD, expectedMD, atol=1e-15)
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))