code: def get_per_attribute_accuracy(
      filtered_input_map, predict_attribute="concept"
  ):
      to_predict_attributes = list(
          list(filtered_input_map.values())[0].keys()
      )
      to_predict_attributes.remove("prediction")
      to_predict_attributes.remove("income")
      to_predict_attributes.remove("url")
      to_predict_attributes.remove("raw_prediction")
      if "confidence_scores" in to_predict_attributes:
          to_predict_attributes.remove("confidence_scores")
      print(to_predict_attributes)
      gt_values = [
          item[predict_attribute]
          for item in list(filtered_input_map.values())
      ]
      preds_values = [
          item["prediction"]
          for item in list(filtered_input_map.values())
      ]
  
      # we compute the overall accuracy
      correct, total = 0, 0
      for idx in range(len(gt_values)):
          total += 1
          correct += int(gt_values[idx] in list(set(preds_values[idx])))
      overall_accuracy = round(100.0 * (correct / total), 3)
      print(f"Overall accuracy: {overall_accuracy}")
  
      output_attributes_acc_map = {}
      for attribute in to_predict_attributes:
          attribute_values = [
              item[attribute]
              for item in list(filtered_input_map.values())
          ]
  
          attribute_correct_incorrect = {}
          for idx in range(len(gt_values)):
              is_correct = int(
                  gt_values[idx] in list(set(preds_values[idx]))
              )
              if attribute_values[idx] in attribute_correct_incorrect:
                  attribute_correct_incorrect[attribute_values[idx]][
                      "freq"
                  ] = (
                      attribute_correct_incorrect[
                          attribute_values[idx]
                      ]["freq"]
                      + 1
                  )
                  attribute_correct_incorrect[attribute_values[idx]][
                      "correct"
                  ] = (
                      attribute_correct_incorrect[
                          attribute_values[idx]
                      ]["correct"]
                      + is_correct
                  )
              else:
                  attribute_correct_incorrect[
                      attribute_values[idx]
                  ] = {}
                  attribute_correct_incorrect[attribute_values[idx]][
                      "freq"
                  ] = 1
                  attribute_correct_incorrect[attribute_values[idx]][
                      "correct"
                  ] = is_correct
          attribute_accuracy_map = {}
          for key, val in attribute_correct_incorrect.items():
              attribute_accuracy_map[key] = {}
              attribute_accuracy_map[key]["hit_rate"] = round(
                  (val["correct"] / val["freq"]) * 100.0, 3
              )
              attribute_accuracy_map[key]["miss_rate"] = round(
                  100.0 - attribute_accuracy_map[key]["hit_rate"], 3
              )
              attribute_accuracy_map[key]["total"] = val["freq"]
          output_attributes_acc_map[attribute] = attribute_accuracy_map
      return output_attributes_acc_map
  
imports: import json
  import os
  from math import ceil, floor
  from pathlib import Path
  import matplotlib.pyplot
  import numpy
  import pandas
  import seaborn
  from IPython.display import display_html
  from matplotlib.ticker import FixedLocator
  from vissl.utils.io import load_file, save_file
label_desc: Use image node_id 3 for calling a global function with example usage: get_per_attribute_accuracy(filtered_input_map, predict_attribute) and returns: output_attributes_acc_map