code: def test_tcav(self):
      random.seed(
          0
      )  # Sets seed since create_comparison_splits() uses random.
  
      config = {
          "concept_set_ids": [
              _ALPHABET_EXAMPLES[0]["_id"],
              _ALPHABET_EXAMPLES[2]["_id"],
              _ALPHABET_EXAMPLES[3]["_id"],
              _ALPHABET_EXAMPLES[7]["_id"],
          ],
          "class_to_explain": "1",
          "grad_layer": "cls_grad",
          "random_state": 0,
      }
  
      result = self.tcav.run(
          _ALPHABET_EXAMPLES,
          self.model,
          self.alphabet_dataset,
          config=config,
      )
      self.assertLen(result, 1)
  
      expected = {
          "p_val": 0.13311,
          "random_mean": 0.56667,
          "result": {
              "score": 0.33333,
              "cos_sim": [
                  0.088691,
                  -0.12179,
                  0.16013,
                  0.24840,
                  -0.09793,
                  0.05166,
                  -0.21578,
                  -0.06560,
                  -0.14759,
              ],
              "dot_prods": [
                  189.085096,
                  -266.36317,
                  344.350498,
                  547.144949,
                  -211.663965,
                  112.502439,
                  -472.72066,
                  -144.529598,
                  -323.31888,
              ],
              "accuracy": 0.66667,
              "cav": [
                  [
                      0.91326976,
                      -13.67988429,
                      -1.33965892,
                      12.23702997,
                      4.83590182,
                      -20.6276055,
                      19.07518597,
                      4.9641991,
                      -5.52570226,
                      10.37834134,
                      0.53685622,
                      -5.21721739,
                      12.00234068,
                      -26.36114057,
                      6.20088358,
                      4.76729567,
                      26.4359945,
                      16.30961659,
                      14.70620605,
                      -13.47771528,
                      5.29218365,
                      0.87290488,
                      10.19441762,
                      2.96687215,
                      -0.70745918,
                      -12.201803,
                      -10.65010904,
                      -5.90814342,
                      -25.17510006,
                      -5.90629019,
                      26.53638293,
                      27.44054429,
                      -11.75430314,
                      -3.72779609,
                      10.28197421,
                      -11.58444132,
                      -18.09351946,
                      -22.09520524,
                      -30.04023056,
                      -16.7551763,
                      -12.34913637,
                      30.27897114,
                      -13.98790656,
                      0.65758253,
                      3.75770261,
                      4.81132118,
                      -11.18005293,
                      5.85445303,
                      18.88336475,
                      -7.34885733,
                      -35.76094848,
                      -3.39495953,
                      5.52774132,
                      -8.38126488,
                      10.07413613,
                      -1.96825956,
                      17.97041089,
                      -2.47085774,
                      19.5700424,
                      -49.46295186,
                      0.12541183,
                      -6.95592842,
                      -0.33562953,
                      12.9269603,
                      -13.6288284,
                      -9.51211543,
                      21.22778867,
                      -2.81344371,
                      -9.66434107,
                      -15.41551695,
                      -30.15406401,
                      14.65903841,
                      2.51729041,
                      17.70711379,
                      13.21615045,
                      12.55899318,
                      11.45749114,
                      -25.67659992,
                      13.00876054,
                      -1.52499005,
                      27.45026658,
                      -4.36110401,
                      10.01664277,
                      -11.24470769,
                      -6.79411522,
                      -1.67106503,
                      -2.59389537,
                      11.72310319,
                      -0.84126818,
                      2.03886137,
                      -11.25047383,
                      -8.60679631,
                      -23.1676229,
                      22.83532544,
                      -25.2657054,
                      -15.49795527,
                      -1.62890474,
                      -15.49504251,
                      27.26973702,
                      -8.00652979,
                      6.87541861,
                      -3.61878753,
                      0.82889822,
                      -2.88891667,
                      6.13730358,
                      12.55884424,
                      -2.24121286,
                      45.90285087,
                      34.43108722,
                      -13.32567113,
                      19.0988537,
                      2.16242269,
                      17.45654791,
                      18.17472208,
                      18.28023357,
                      -20.34869744,
                      -11.21275755,
                      6.0583063,
                      -10.38857432,
                      -7.30056744,
                      -8.85395997,
                      -17.19779724,
                      -8.12087822,
                      2.46058364,
                      29.35061395,
                      -6.53820405,
                      10.3522653,
                      8.54478485,
                  ]
              ],
          },
      }
      testing_utils.assert_deep_almost_equal(self, expected, result[0])
  
file_path: lit/lit_nlp/components/tcav_int_test.py
imports: import random
  from absl.testing import absltest
  from absl.testing import parameterized
  from lit_nlp.api import dataset
  from lit_nlp.components import tcav
  from lit_nlp.examples.models import glue_models
  from lit_nlp.lib import caching
  from lit_nlp.lib import testing_utils
  from lit_nlp.lib import file_cache
label_desc: Use image node_id 3 for calling the ModelBasedTCAVTest obj's underlying member method code with example usage: obj.test_tcav() without return types