code: def _stratified_pointwise_generator(datastore, pos_ratio):
      while True:
          if random.random() <= pos_ratio:
              entry = datastore.next_random_record()
              yield {
                  "user_id": entry["user_id"],
                  "item_id": entry["item_id"],
                  "label": 1.0,
              }
          else:
              user_id = random.randint(0, datastore.total_users() - 1)
              item_id = random.randint(0, datastore.total_items() - 1)
              while datastore.is_positive(user_id, item_id):
                  user_id = random.randint(
                      0, datastore.total_users() - 1
                  )
                  item_id = random.randint(
                      0, datastore.total_items() - 1
                  )
              yield {
                  "user_id": user_id,
                  "item_id": item_id,
                  "label": 0.0,
              }
  
file_path: openrec/openrec/tf2/data/dataset.py
imports: from openrec.tf2.data import _ParallelDataset
  from openrec.tf2.data import _DataStore
  import tensorflow
  import numpy
  import random
label_desc: Use image node_id 2 for calling a global function with example usage: _stratified_pointwise_generator(datastore, pos_ratio) without return types