class_docstr: Graph modality
  
  Parameters
  ----------
  data: List[str], required
      A list encoding an adjacency matrix, of a user or an item graph, in the sparse triplet format,         e.g., data=[('user1', 'user4', 1.0)].
class_docstr_tok: ["Graph","modality","Parameters","--","--","--","--","--","data",":","List","[","str","]",",","required","A","list","encoding","an","adjacency","matrix",",","of","a","user","or","an","item","graph",",","in","the","sparse","triplet","format",",","e.g.",",","data=","[","(","'user1","'",",","'user4","'",",","1.0",")","]","."]
docstr: Get the subset of relations which align with the training data
  
  Parameters
  ----------
  train_row_ids: array, required
      An array containing the ids of training objects (users or items) for which to get the "out" relations. 
  train_col_ids: array, required
      An array containing the ids of training objects (users or items) for whom to get the "in" relations.
      Please refer to cornac/models/c2pf/recom_c2pf.py for a concrete usage example of this function.
  
  Returns
  -------
  A subset of the adjacency matrix, in the sparse triplet format, whose elements align with the training         set as specified by "train_row_ids" and "train_col_ids".
docstr_tok: ["Get","the","subset","of","relations","which","align","with","the","training","data","Parameters","--","--","--","--","--","train_row_ids",":","array",",","required","An","array","containing","the","ids","of","training","objects","(","users","or","items",")","for","which","to","get","the","``","out","''","relations",".","train_col_ids",":","array",",","required","An","array","containing","the","ids","of","training","objects","(","users","or","items",")","for","whom","to","get","the","``","in","''","relations",".","Please","refer","to","cornac\/models\/c2pf\/recom_c2pf.py","for","a","concrete","usage","example","of","this","function",".","Returns","--","--","--","-","A","subset","of","the","adjacency","matrix",",","in","the","sparse","triplet","format",",","whose","elements","align","with","the","training","set","as","specified","by","``","train_row_ids","''","and","``","train_col_ids","''","."]
code: def get_train_triplet(self, train_row_ids, train_col_ids):
      """Get the subset of relations which align with the training data
  
          Parameters
          ----------
          train_row_ids: array, required
              An array containing the ids of training objects (users or items) for which to get the "out" relations. \
  
          train_col_ids: array, required
              An array containing the ids of training objects (users or items) for whom to get the "in" relations.
              Please refer to cornac/models/c2pf/recom_c2pf.py for a concrete usage example of this function.
  
          Returns
          -------
          A subset of the adjacency matrix, in the sparse triplet format, whose elements align with the training \
          set as specified by "train_row_ids" and "train_col_ids".
          """
      picked_idx = []
      train_row_ids = (
          set(train_row_ids)
          if not isinstance(train_row_ids, set)
          else train_row_ids
      )
      train_col_ids = (
          set(train_col_ids)
          if not isinstance(train_col_ids, set)
          else train_col_ids
      )
      for idx, (i, j) in enumerate(zip(self.map_rid, self.map_cid)):
          if (i not in train_row_ids) or (j not in train_col_ids):
              continue
          picked_idx.append(idx)
  
      return (
          self.map_rid[picked_idx],
          self.map_cid[picked_idx],
          self.val[picked_idx],
      )
  
file_path: cornac/cornac/data/graph.py
imports: import scipy.sparse
  import numpy
  from tqdm.auto import trange
  from .None import FeatureModality
label_desc: Use image node_id 5 for calling the GraphModality obj's underlying member method code with example usage: obj.get_train_triplet(train_row_ids, train_col_ids) and returns: self,  self,  self