code: def test_classification_stats():
      import pytest
      from speechbrain.utils.metric_stats import ClassificationStats
  
      stats = ClassificationStats()
      stats.append(
          ids=["1", "2"], predictions=["B", "A"], targets=["B", "A"]
      )
      stats.append(
          ids=["3", "4"], predictions=["A", "B"], targets=["B", "C"]
      )
  
      summary = stats.summarize()
      assert pytest.approx(summary["accuracy"], 0.01) == 0.5
      classwise_accuracy = summary["classwise_accuracy"]
      assert pytest.approx(classwise_accuracy["A"]) == 1.0
      assert pytest.approx(classwise_accuracy["B"]) == 0.5
      assert pytest.approx(classwise_accuracy["C"]) == 0.0
  
file_path: speechbrain/tests/unittests/test_metrics.py
imports: import torch
  import torch.nn
  import math
label_desc: Use image node_id 6 for calling a global function with example usage: test_classification_stats() without return types