docstr: Sampler configuration
  
  Args:
      balance (bool, optional): If True, samples equal number of training samples for each class per batch.
          Defaults to False.
      class_weights (list, optional): Weights of classes if the classes are not equally weighted.
          Defaults to None.
      balance_domain (bool, optional): If True, samples equal number of training samples for each domain per
          batch. Defaults to False.
docstr_tok: ["Sampler","configuration","Args",":","balance","(","bool",",","optional",")",":","If","True",",","samples","equal","number","of","training","samples","for","each","class","per","batch",".","Defaults","to","False",".","class_weights","(","list",",","optional",")",":","Weights","of","classes","if","the","classes","are","not","equally","weighted",".","Defaults","to","None",".","balance_domain","(","bool",",","optional",")",":","If","True",",","samples","equal","number","of","training","samples","for","each","domain","per","batch",".","Defaults","to","False","."]
code: def __init__(
      self, balance=False, class_weights=None, balance_domain=False
  ):
      """Sampler configuration
  
      Args:
          balance (bool, optional): If True, samples equal number of training samples for each class per batch.
              Defaults to False.
          class_weights (list, optional): Weights of classes if the classes are not equally weighted.
              Defaults to None.
          balance_domain (bool, optional): If True, samples equal number of training samples for each domain per
              batch. Defaults to False.
      """
      if balance and class_weights is not None:
          raise ValueError(
              "Params 'balance' and 'weights' are incompatible"
          )
      self._balance = balance
      self._balance_domain = balance_domain
      self._class_weights = class_weights
      self._balance_domain = balance_domain
  
imports: import logging
  import numpy
  import torch.utils.data
  import torchvision
  from torch.utils.data.sampler import BatchSampler, RandomSampler
label_desc: Use image node_id 1 to create a new SamplingConfig object  with example: obj = SamplingConfig(balance, class_weights, balance_domain)