class_docstr: Class providing an artificial backend, that reads data into memory.
class_docstr_tok: ["Class","providing","an","artificial","backend",",","that","reads","data","into","memory","."]
docstr: Get objects complementary to triples (s,p,?).
  
  For a given triple retrieves all triples with same subjects and predicates.
  Function used during evaluation.
  
  Parameters
  ----------
  triples : list or array
       List or array of arrays with 3 elements (subject, predicate, object).
  
  Returns
  -------
  subjects : list
       Objects present in the input triples.
docstr_tok: ["Get","objects","complementary","to","triples","(","s",",","p",",","?",")",".","For","a","given","triple","retrieves","all","triples","with","same","subjects","and","predicates",".","Function","used","during","evaluation",".","Parameters","--","--","--","--","--","triples",":","list","or","array","List","or","array","of","arrays","with","3","elements","(","subject",",","predicate",",","object",")",".","Returns","--","--","--","-","subjects",":","list","Objects","present","in","the","input","triples","."]
code: def _get_complementary_objects(self, triples, use_filter=False):
      """Get objects complementary to triples (s,p,?).
  
      For a given triple retrieves all triples with same subjects and predicates.
      Function used during evaluation.
  
      Parameters
      ----------
      triples : list or array
           List or array of arrays with 3 elements (subject, predicate, object).
  
      Returns
      -------
      subjects : list
           Objects present in the input triples.
      """
      logger.debug("Getting complementary objects")
  
      if self.parent is not None:
          logger.debug(
              "Parent is set, WARNING: The triples returned are coming with parent indexing."
          )
  
          logger.debug("Recover original indexes.")
          triples_original_index = self.mapper.get_indexes(
              triples, order="ind2raw"
          )
          #            with shelve.open(self.mapper.reversed_entities_dict) as ents:
          #                with shelve.open(self.mapper.reversed_relations_dict) as rels:
          #                    triples_original_index = np.array([(ents[str(xx[0])], rels[str(xx[1])],
          # ents[str(xx[2])]) for xx in triples], dtype=np.int32)
          logger.debug("Query parent for data.")
          objects = self.parent.get_complementary_objects(
              triples_original_index
          )
          logger.debug(
              "What to do with this new indexes? Evaluation should happen in \
              the original space, shouldn't it? I'm assuming it does so returning in parent indexing."
          )
          return objects
      elif self.use_filter is False or self.use_filter is None:
          self.use_filter = {"train-org": self.data}
      filtered = []
      for filter_name, filter_source in self.use_filter.items():
          source = self.get_source(filter_source, filter_name)
  
          # load source if not loaded
          source = self.get_source(filter_source, filter_name)
          # filter
  
          tmp_filter = []
          for triple in triples:
              tmp = source[source[:, 0] == triple[0]]
              tmp_filter.append(
                  list(set(tmp[tmp[:, 1] == triple[1]][:, 2]))
              )
          filtered.append(tmp_filter)
  
      # Unpack data into one  list per triple no matter what filter it comes
      # from
      unpacked = list(zip(*filtered))
      objects = []
      for k in unpacked:
          lst = [j for i in k for j in i]
          objects.append(np.array(lst, dtype=np.int32))
  
      return objects
  
imports: import logging
  import tempfile
  import uuid
  from datetime import datetime
  import numpy
  import pandas
  import tensorflow
  from .data_indexer import DataIndexer
  from .source_identifier import DataSourceIdentifier
label_desc: Use image node_id 12 for calling the NoBackend obj's underlying member method code with example usage: obj._get_complementary_objects(triples, use_filter) and returns: objects, objects