original_docstring: 
          Make a dictionary of classes and false 'labels_edges' i.e. 'labels_edges' that do not exist.
          The number of false 'labels_edges' for each class in the dictionary is false_per_true times the true
          'labels_edges' of the class.
          In addition, to be more balance the function take randomly false 'labels_edges' but the number of
          false 'label_edges' corresponding to each class is similar.
          # We need the false 'labels_edges' to be a false instances to the classifier.
          :param dict_class_label_edge
          :return: a dict of classes and their false labels_edges.
          
docstring: Make a dictionary of classes and false 'labels_edges' i.e. 'labels_edges' that do not exist.
  The number of false 'labels_edges' for each class in the dictionary is false_per_true times the true
  'labels_edges' of the class.
  In addition, to be more balance the function take randomly false 'labels_edges' but the number of
  false 'label_edges' corresponding to each class is similar.
  We need the false 'labels_edges' to be a false instances to the classifier.
  :param dict_class_label_edge
  :return: a dict of classes and their false labels_edges.
docstring_tokens: Make a dictionary of classes and false ' labels_edges ' i . e . ' labels_edges ' that do not exist . The number of false ' labels_edges ' for each class in the dictionary is false_per_true times the true ' labels_edges ' of the class . In addition to be more balance the function take randomly false ' labels_edges ' but the number of false ' label_edges ' corresponding to each class is similar . We need the false ' labels_edges ' to be a false instances to the classifier . : param dict_class_label_edge : return : a dict of classes and their false labels_edges .
code: def make_false_label_edges(self, dict_class_label_edge):
          """
          Make a dictionary of classes and false 'labels_edges' i.e. 'labels_edges' that do not exist.
          The number of false 'labels_edges' for each class in the dictionary is false_per_true times the true
          'labels_edges' of the class.
          In addition, to be more balance the function take randomly false 'labels_edges' but the number of
          false 'label_edges' corresponding to each class is similar.
          # We need the false 'labels_edges' to be a false instances to the classifier.
          :param dict_class_label_edge
          :return: a dict of classes and their false labels_edges.
          """
          data_path = self.args.data_name + '_false_edges_balanced_{}.pickle'.format(self.args.false_per_true)
          if os.path.exists(os.path.join(self.args.data_name, data_path)):
              with open(os.path.join(self.args.data_name, data_path), 'rb') as handle:
                  dict_class_false_edges = pickle.load(handle)
          else:
              dict_class_false_edges = {}
              labels = list(dict_class_label_edge.keys())
              false_labels = []
              for label in labels:
                  for edge in dict_class_label_edge[label]:
                      if edge[0][0] == 'c':
                          label = edge[0]
                          movie = edge[1]
                      else:
                          label = edge[1]
                          movie = edge[0]
                      if len(false_labels) < self.args.false_per_true + 1:
                          false_labels = list(set(labels) - set(label))
                      else:
                          false_labels = list(set(false_labels) - set(label))
                      indexes = random.sample(range(1, len(false_labels)), self.args.false_per_true)
                      for i, index in enumerate(indexes):
                          if dict_class_false_edges.get(label) is None:
                              dict_class_false_edges[label] = [[movie, false_labels[index]]]
                          else:
                              edges = dict_class_false_edges[label]
                              edges.append([movie, false_labels[index]])
                              dict_class_false_edges[label] = edges
                      false_labels = list(np.delete(np.array(false_labels), indexes))
              try:
                  with open(os.path.join(self.args.data_name, data_path), 'wb') as handle:
                      pickle.dump(dict_class_false_edges, handle, protocol=3)
              except:
                  pass
          return dict_class_false_edges
code_tokens: def make_false_label_edges ( self , dict_class_label_edge ) : data_path = self . args . data_name + '_false_edges_balanced_{}.pickle' . format ( self . args . false_per_true ) if os . path . exists ( os . path . join ( self . args . data_name , data_path ) ) : with open ( os . path . join ( self . args . data_name , data_path ) , 'rb' ) as handle : dict_class_false_edges = pickle . load ( handle ) else : dict_class_false_edges = { } labels = list ( dict_class_label_edge . keys ( ) ) false_labels = [ ] for label in labels : for edge in dict_class_label_edge [ label ] : if edge [ 0 ] [ 0 ] == 'c' : label = edge [ 0 ] movie = edge [ 1 ] else : label = edge [ 1 ] movie = edge [ 0 ] if len ( false_labels ) < self . args . false_per_true + 1 : false_labels = list ( set ( labels ) - set ( label ) ) else : false_labels = list ( set ( false_labels ) - set ( label ) ) indexes = random . sample ( range ( 1 , len ( false_labels ) ) , self . args . false_per_true ) for i , index in enumerate ( indexes ) : if dict_class_false_edges . get ( label ) is None : dict_class_false_edges [ label ] = [ [ movie , false_labels [ index ] ] ] else : edges = dict_class_false_edges [ label ] edges . append ( [ movie , false_labels [ index ] ] ) dict_class_false_edges [ label ] = edges false_labels = list ( np . delete ( np . array ( false_labels ) , indexes ) ) try : with open ( os . path . join ( self . args . data_name , data_path ) , 'wb' ) as handle : pickle . dump ( dict_class_false_edges , handle , protocol = 3 ) except : pass return dict_class_false_edges
short_docstring: Make a dictionary of classes and false 'labels_edges' i.e.
short_docstring_tokens: Make a dictionary of classes and false ' labels_edges ' i . e .
comment: """
          Make a dictionary of classes and false 'labels_edges' i.e. 'labels_edges' that do not exist.
          The number of false 'labels_edges' for each class in the dictionary is false_per_true times the true
          'labels_edges' of the class.
          In addition, to be more balance the function take randomly false 'labels_edges' but the number of
          false 'label_edges' corresponding to each class is similar.
          # We need the false 'labels_edges' to be a false instances to the classifier.
          :param dict_class_label_edge
          :return: a dict of classes and their false labels_edges.
          """