original_docstring: 
      Return sample weight for stratistifed random sampling
      :param data_folder: Dataset folder object
      :return:
      
docstring: Return sample weight for stratistifed random sampling
docstring_tokens: Return sample weight for stratistifed random sampling
code: def sample_weight(data_folder):
      """
      Return sample weight for stratistifed random sampling
      :param data_folder: Dataset folder object
      :return:
      """
      class_sample_count = np.array(
          [len([i for i in data_folder.targets if i == t]) for t in range(0, len(data_folder.classes))])
      weight = 1 / class_sample_count
      samples_weight = np.array([weight[t] for t in data_folder.targets])
      samples_weight = torch.from_numpy(samples_weight)
      samples_weight = samples_weight.double()
      sampler = WeightedRandomSampler(samples_weight, len(samples_weight))
      return sampler
code_tokens: def sample_weight ( data_folder ) : class_sample_count = np . array ( [ len ( [ i for i in data_folder . targets if i == t ] ) for t in range ( 0 , len ( data_folder . classes ) ) ] ) weight = 1 / class_sample_count samples_weight = np . array ( [ weight [ t ] for t in data_folder . targets ] ) samples_weight = torch . from_numpy ( samples_weight ) samples_weight = samples_weight . double ( ) sampler = WeightedRandomSampler ( samples_weight , len ( samples_weight ) ) return sampler
short_docstring: Return sample weight for stratistifed random sampling
short_docstring_tokens: Return sample weight for stratistifed random sampling
comment: """
      Return sample weight for stratistifed random sampling
      :param data_folder: Dataset folder object
      :return:
      """