code: def analysis_dataset(dataset):
      standard_sample_cnt = 0
      adversarial_sample_cnt = 0
      flipped_label_cnt = 0
      duplicated_samples = {}
      for each_sample in dataset:
          if each_sample["source"] == "standard":
              standard_sample_cnt += 1
          else:
              adversarial_sample_cnt += 1
          if each_sample["gold_labels"][0] != each_sample["labels"][0]:
              flipped_label_cnt += 1
          if each_sample["text"] in duplicated_samples:
              duplicated_samples[each_sample["text"]] += 1
          else:
              duplicated_samples[each_sample["text"]] = 1
      duplicated_samples = {
          k: v
          for k, v in sorted(
              duplicated_samples.items(), key=lambda item: item[1]
          )
      }
      duplicated_samples = {
          k: v for k, v in duplicated_samples.items() if int(v) >= 2
      }
  
      all_values = list(duplicated_samples.values())
      max_value = 0 if len(all_values) == 0 else max(all_values)
      mean_value = 0 if len(all_values) == 0 else np.mean(all_values)
      logging.info(
          f"Real noise level {flipped_label_cnt / (standard_sample_cnt + adversarial_sample_cnt)}"
      )
      logging.info(
          f"Standard samples: {standard_sample_cnt} adversarial samples: {adversarial_sample_cnt}"
      )
      logging.info(
          f"It has {len(duplicated_samples)} duplicated samples, the the maximum appearance {max_value}, in average {mean_value}"
      )
  
file_path: ParlAI/parlai/tasks/safety_mix/build.py
imports: import copy
  import hashlib
  import json
  import os
  import random
  import numpy
  import parlai.core.build_data
  import parlai.utils.logging
  from parlai.core.build_data import DownloadableFile
label_desc: Use image node_id 1 for calling a global function with example usage: analysis_dataset(dataset) without return types