def test_link_clustering(matrix, taxa): similarity_matrix = [[1 - cell for cell in row] for row in matrix] for val in [True, False]: for val2 in [True, False]: link_clustering(0.5, matrix, taxa, matrix_type="distances", revert=val, fuzzy=val2) link_clustering(0.5, similarity_matrix, taxa, matrix_type="similarities", revert=val, fuzzy=val2) link_clustering(0.5, similarity_matrix, taxa, matrix_type="weights", revert=val, fuzzy=val2) with pytest.raises(ValueError): link_clustering(0.5, matrix, taxa, matrix_type="dummy")
def test_link_clustering(self): similarity_matrix = [[1 - cell for cell in row] for row in self.matrix] for val in [True, False]: for val2 in [True, False]: link_clustering(0.5, self.matrix, self.taxa, matrix_type="distances", revert=val, fuzzy=val2) link_clustering(0.5, similarity_matrix, self.taxa, matrix_type="similarities", revert=val, fuzzy=val2) link_clustering(0.5, similarity_matrix, self.taxa, matrix_type="weights", revert=val, fuzzy=val2) assert_raises(ValueError, link_clustering, 0.5, self.matrix, self.taxa, matrix_type="dummy")
def test_link_clustering(self): from lingpy.algorithm.clustering import link_clustering similarity_matrix = [[1-cell for cell in row] for row in self.matrix] for val in [True,False]: for val2 in [True, False]: link_clustering(0.5, self.matrix, self.taxa, matrix_type="distances", revert=val, fuzzy=val2) link_clustering(0.5, similarity_matrix, self.taxa, matrix_type="similarities", revert=val, fuzzy=val2) link_clustering(0.5, similarity_matrix, self.taxa, matrix_type="weights", revert=val, fuzzy=val2) assert_raises(ValueError, link_clustering, 0.5, self.matrix, self.taxa, matrix_type="dummy")
def test_link_clustering(self): from lingpy.algorithm.clustering import link_clustering for mt in {"distances", "similarities", "weights"}: link_clustering(0.5, [[1, 0], [0, 1]], ['a', 'b'], matrix_type=mt)