Example #1
0
 def test_clustering_DBSCAN_direct(self, ens1):
     pytest.importorskip('sklearn')
     method = encore.DBSCAN(eps=0.5, min_samples=2)
     distance_matrix = encore.get_distance_matrix(ens1)
     cluster_assignment, details = method(distance_matrix)
     expected_value = 2
     assert len(set(cluster_assignment)) == expected_value, \
                  "Unexpected result: {0}".format(cluster_assignment)
Example #2
0
 def test_clustering_DBSCAN_direct(self):
     method = encore.DBSCAN(eps=0.5, min_samples=2)
     distance_matrix = encore.get_distance_matrix(self.ens1)
     cluster_assignment, details = method(distance_matrix)
     expected_value = 2
     assert_equal(
         len(set(cluster_assignment)),
         expected_value,
         err_msg="Unexpected result: {0}".format(cluster_assignment))
Example #3
0
 def test_clustering_two_different_methods(self, ens1):
     pytest.importorskip('sklearn')
     cluster_collection = encore.cluster(
         [ens1],
         method=[
             encore.AffinityPropagation(preference=-7.5),
             encore.DBSCAN(min_samples=2)
         ])
     assert len(cluster_collection[0]) == len(cluster_collection[1]), \
                  "Unexpected result: {0}".format(cluster_collection)
Example #4
0
 def test_clustering_two_different_methods(self):
     cluster_collection = encore.cluster(
         [self.ens1],
         method=[
             encore.AffinityPropagation(preference=-7.5),
             encore.DBSCAN(min_samples=2)
         ])
     print(cluster_collection)
     print(cluster_collection)
     assert_equal(
         len(cluster_collection[0]),
         len(cluster_collection[1]),
         err_msg="Unexpected result: {0}".format(cluster_collection))