class_docstr: :class:`NegSampleDataLoader` is an abstract class which can sample negative examples by ratio.
  It has two neg-sampling method, the one is 1-by-1 neg-sampling (pair wise),
  and the other is 1-by-multi neg-sampling (point wise).
  
  Args:
      config (Config): The config of dataloader.
      dataset (Dataset): The dataset of dataloader.
      sampler (Sampler): The sampler of dataloader.
      shuffle (bool, optional): Whether the dataloader will be shuffle after a round. Defaults to ``False``.
class_docstr_tok: [":","class",":","`","NegSampleDataLoader","`","is","an","abstract","class","which","can","sample","negative","examples","by","ratio",".","It","has","two","neg-sampling","method",",","the","one","is","1-by-1","neg-sampling","(","pair","wise",")",",","and","the","other","is","1-by-multi","neg-sampling","(","point","wise",")",".","Args",":","config","(","Config",")",":","The","config","of","dataloader",".","dataset","(","Dataset",")",":","The","dataset","of","dataloader",".","sampler","(","Sampler",")",":","The","sampler","of","dataloader",".","shuffle","(","bool",",","optional",")",":","Whether","the","dataloader","will","be","shuffle","after","a","round",".","Defaults","to","``","False","``","."]
code: def _set_neg_sample_args(
      self, config, dataset, dl_format, neg_sample_args
  ):
      self.uid_field = dataset.uid_field
      self.iid_field = dataset.iid_field
      self.dl_format = dl_format
      self.neg_sample_args = neg_sample_args
      self.times = 1
      if (
          self.neg_sample_args["distribution"]
          in ["uniform", "popularity"]
          and self.neg_sample_args["sample_num"] != "none"
      ):
          self.neg_sample_num = self.neg_sample_args["sample_num"]
  
          if self.dl_format == InputType.POINTWISE:
              self.times = 1 + self.neg_sample_num
              self.sampling_func = (
                  self._neg_sample_by_point_wise_sampling
              )
  
              self.label_field = config["LABEL_FIELD"]
              dataset.set_field_property(
                  self.label_field,
                  FeatureType.FLOAT,
                  FeatureSource.INTERACTION,
                  1,
              )
          elif self.dl_format == InputType.PAIRWISE:
              self.times = self.neg_sample_num
              self.sampling_func = (
                  self._neg_sample_by_pair_wise_sampling
              )
  
              self.neg_prefix = config["NEG_PREFIX"]
              self.neg_item_id = self.neg_prefix + self.iid_field
  
              columns = (
                  [self.iid_field]
                  if dataset.item_feat is None
                  else dataset.item_feat.columns
              )
              for item_feat_col in columns:
                  neg_item_feat_col = self.neg_prefix + item_feat_col
                  dataset.copy_field_property(
                      neg_item_feat_col, item_feat_col
                  )
          else:
              raise ValueError(
                  f"`neg sampling by` with dl_format [{self.dl_format}] not been implemented."
              )
  
      elif (
          self.neg_sample_args["distribution"] != "none"
          and self.neg_sample_args["sample_num"] != "none"
      ):
          raise ValueError(
              f'`neg_sample_args` [{self.neg_sample_args["distribution"]}] is not supported!'
          )
  
imports: import math
  import copy
  from logging import getLogger
  import torch
  from recbole.data.interaction import Interaction
  from recbole.utils import InputType, FeatureType, FeatureSource, ModelType
  from recbole.data.transform import construct_transform
label_desc: Use image node_id 2 for calling the NegSampleDataLoader obj's underlying member method code with example usage: obj._set_neg_sample_args(config, dataset, dl_format, neg_sample_args) without return types