def test_maxinconsts_one_cluster_linkage(self): # Tests maxinconsts(Z, R) on linkage with one cluster. Z = np.asarray([[0, 1, 0.3, 4]], dtype=np.double) R = np.asarray([[0, 0, 0, 0.3]], dtype=np.double) MD = maxinconsts(Z, R) expectedMD = calculate_maximum_inconsistencies(Z, R) assert_allclose(MD, expectedMD, atol=1e-15)
def check_maxinconsts_Q_linkage(self, method): # Tests maxinconsts(Z, R) on the Q data set X = hierarchy_test_data.Q_X Z = linkage(X, method) R = inconsistent(Z) MD = maxinconsts(Z, R) expectedMD = calculate_maximum_inconsistencies(Z, R) assert_allclose(MD, expectedMD, atol=1e-15)