code: def filter_unseen_entities(X, model, verbose=False):
      """Filter unseen entities in the test set.
  
      Parameters
      ----------
      X : ndarray, shape (n, 3)
          An array of test triples.
      model : ampligraph.latent_features.EmbeddingModel
          A knowledge graph embedding model.
      verbose : bool
          Verbose mode.
  
      Returns
      -------
      filtered X : ndarray, shape (n, 3)
          An array of test triples containing no unseen entities.
      """
      logger.debug(
          "Finding entities in the dataset that are not previously seen by model"
      )
      ent_seen = np.unique(list(model.ent_to_idx.keys()))
      df = pd.DataFrame(X, columns=["s", "p", "o"])
      filtered_df = df[df.s.isin(ent_seen) & df.o.isin(ent_seen)]
      n_removed_ents = df.shape[0] - filtered_df.shape[0]
      if n_removed_ents > 0:
          msg = (
              "Removing {} triples containing unseen entities. ".format(
                  n_removed_ents
              )
          )
          if verbose:
              logger.info(msg)
          logger.debug(msg)
          return filtered_df.values
      return X
  
imports: import logging
  from collections.abc import Iterable
  from itertools import islice, product
  import numpy
  import pandas
  from tqdm import tqdm
  from ..evaluation import hits_at_n_score, mr_score, mrr_score
label_desc: Use image node_id 2 for calling a global function with example usage: filter_unseen_entities(X, model, verbose) and returns: X, filtered_df