code: def test_special_case(self):
      ground_truth = np.array([0, 1, 3, 1, 1])
      predict = np.array([0, 1, 3, 3, 1])
      mcm_sklearn = metrics.multilabel_confusion_matrix(
          ground_truth, predict
      )
      accuracy = Accuracy(
          metrics=["precision", "recall", "F1", "accuracy"]
      )
      mcm_graph4ai = accuracy._calculate_confusion_matrix(
          ground_truth=ground_truth, predict=predict
      )
  
      self.assertEqual(True, (mcm_graph4ai == mcm_sklearn).all())
      print("mcm test passed")
  
      (
          precision_sklearn,
          recall_sklearn,
          f1_sklearn,
          _,
      ) = metrics.precision_recall_fscore_support(
          y_true=ground_truth, y_pred=predict, average="micro"
      )
  
      accuracy_sklearn = metrics.accuracy_score(
          y_true=ground_truth, y_pred=predict
      )
  
      (
          precision_graph4ai,
          recall_graph4ai,
          f1_graph4ai,
          accuracy_graph4ai,
      ) = accuracy.calculate_scores(
          ground_truth=torch.from_numpy(ground_truth),
          predict=torch.from_numpy(predict),
          average="micro",
      )
      self.assertEqual(precision_graph4ai, precision_sklearn)
      self.assertEqual(recall_graph4ai, recall_sklearn)
      self.assertEqual(f1_graph4ai, f1_sklearn)
      self.assertEqual(accuracy_graph4ai, accuracy_sklearn)
  
      print("micro average special case test passed")
  
      accuracy_sklearn = metrics.accuracy_score(
          y_true=ground_truth, y_pred=predict
      )
  
      (
          precision_sklearn,
          recall_sklearn,
          f1_sklearn,
          _,
      ) = metrics.precision_recall_fscore_support(
          y_true=ground_truth, y_pred=predict, average="macro"
      )
  
      (
          precision_graph4ai,
          recall_graph4ai,
          f1_graph4ai,
          accuracy_graph4ai,
      ) = accuracy.calculate_scores(
          ground_truth=torch.from_numpy(ground_truth),
          predict=torch.from_numpy(predict),
          average="macro",
      )
      self.assertEqual(precision_graph4ai, precision_sklearn)
      self.assertEqual(recall_graph4ai, recall_sklearn)
      self.assertEqual(f1_graph4ai, f1_sklearn)
      self.assertEqual(accuracy_graph4ai, accuracy_sklearn)
      print("macro average special case test passed")
      accuracy_sklearn = metrics.accuracy_score(
          y_true=ground_truth, y_pred=predict
      )
      (
          precision_sklearn,
          recall_sklearn,
          f1_sklearn,
          _,
      ) = metrics.precision_recall_fscore_support(
          y_true=ground_truth, y_pred=predict, average="weighted"
      )
  
      (
          precision_graph4ai,
          recall_graph4ai,
          f1_graph4ai,
          accuracy_graph4ai,
      ) = accuracy.calculate_scores(
          ground_truth=torch.from_numpy(ground_truth),
          predict=torch.from_numpy(predict),
          average="weighted",
      )
      self.assertEqual(precision_graph4ai, precision_sklearn)
      self.assertEqual(recall_graph4ai, recall_sklearn)
      self.assertEqual(f1_graph4ai, f1_sklearn)
      self.assertEqual(accuracy_graph4ai, accuracy_sklearn)
      print("weighted average special case test passed")
  
file_path: graph4nlp/graph4nlp/pytorch/test/evaluation/test_accuracy.py
imports: import random
  import unittest
  import numpy
  import torch
  import tqdm
  from sklearn import metrics
  from graph4nlp.pytorch.modules.evaluation.accuracy import Accuracy
label_desc: Use image node_id 1 for calling the MyTestCase obj's underlying member method code with example usage: obj.test_special_case() without return types