code: def test_find_clusters():
      X = np.array(
          [
              ["a", "y", "b"],
              ["b", "y", "a"],
              ["a", "y", "c"],
              ["c", "y", "a"],
              ["a", "y", "d"],
              ["c", "x", "d"],
              ["b", "y", "c"],
              ["f", "y", "e"],
          ]
      )
      model = ScoringBasedEmbeddingModel(
          eta=5, k=10, scoring_type="ComplEx"
      )
  
      model.compile(optimizer="adam", loss="multiclass_nll")
  
      model.fit(X, batch_size=1, epochs=10)
  
      clustering_algorithm = DBSCAN(eps=1e-3, min_samples=1)
  
      labels = find_clusters(X, model, clustering_algorithm, mode="t")
      assert np.array_equal(labels, np.array([0, 1, 2, 3, 4, 5, 6, 7]))
  
      labels = find_clusters(
          np.unique(X[:, 0]), model, clustering_algorithm, mode="e"
      )
      assert np.array_equal(labels, np.array([0, 1, 2, 3]))
  
      labels = find_clusters(
          np.unique(X[:, 1]), model, clustering_algorithm, mode="r"
      )
      assert np.array_equal(labels, np.array([0, 1]))
  
      labels = find_clusters(
          np.unique(X[:, 2]), model, clustering_algorithm, mode="e"
      )
      assert np.array_equal(labels, np.array([0, 1, 2, 3, 4]))
  
      with pytest.raises(ValueError):
          find_clusters(X, model, clustering_algorithm, mode="hah")
      with pytest.raises(ValueError):
          find_clusters(X, model, clustering_algorithm, mode="e")
      with pytest.raises(ValueError):
          find_clusters(X, model, clustering_algorithm, mode="r")
      with pytest.raises(ValueError):
          find_clusters(
              np.unique(X[:, 0]), model, clustering_algorithm, mode="t"
          )
  
file_path: AmpliGraph/tests/ampligraph/discovery/test_discovery.py
imports: import numpy
  import pytest
  from sklearn.cluster import DBSCAN
  from ampligraph.discovery.discovery import discover_facts, generate_candidates, _setdiff2d, find_clusters, find_duplicates, query_topn
  from ampligraph.latent_features import ScoringBasedEmbeddingModel
label_desc: Use image node_id 4 for calling a global function with example usage: test_find_clusters() without return types