code: def test_explanation_dataclass():
      explanation = Explanation(target="target")
  
      feature_attributions_for_label_1 = np.array([1, 2, 3])
      feature_attributions_for_label_2 = np.array([4, 5, 6])
  
      # test add()
      explanation.add(
          ["f1", "f2", "f3"], feature_attributions_for_label_1
      )
  
      with pytest.raises(
          AssertionError, match="Expected feature attributions of shape"
      ):
          # test add() with wrong shape
          explanation.add(
              ["f1", "f2", "f3", "f4"], np.array([1, 2, 3, 4])
          )
  
      explanation.add(
          ["f1", "f2", "f3"], feature_attributions_for_label_2
      )
  
      # test to_array()
      explanation_array = explanation.to_array()
      assert np.array_equal(explanation_array, [[1, 2, 3], [4, 5, 6]])
  
imports: import logging
  import os
  import numpy
  import pandas
  import pytest
  from ludwig.api import LudwigModel
  from ludwig.constants import BATCH_SIZE, BINARY, CATEGORY, MINIMUM_BATCH_SIZE, MODEL_ECD, MODEL_GBM, TYPE
  from ludwig.explain.captum import IntegratedGradientsExplainer
  from ludwig.explain.explainer import Explainer
  from ludwig.explain.explanation import Explanation
  from ludwig.explain.gbm import GBMExplainer
  from tests.integration_tests.utils import binary_feature, category_feature, date_feature, generate_data, image_feature, LocalTestBackend, number_feature, sequence_feature, set_feature, text_feature, timeseries_feature, vector_feature
label_desc: Use image node_id 1 for calling a global function with example usage: test_explanation_dataclass() without return types