class_docstr: Tests computation of kernel target alignment.
class_docstr_tok: ["Tests","computation","of","kernel","target","alignment","."]
docstr: Test value of kernel target alignment with class label rescaling.
docstr_tok: ["Test","value","of","kernel","target","alignment","with","class","label","rescaling","."]
code: def test_alignment_value_with_normalization(self):
      """Test value of kernel target alignment with class label rescaling."""
      X = [0.1, 0.4, 0.0]
      Y = [1, -1, 1]
  
      alignment = kern.target_alignment(
          X,
          Y,
          lambda x1, x2: _mock_kernel(x1, x2, []),
          rescale_class_labels=True,
      )
      alignment_assume = kern.target_alignment(
          X,
          Y,
          lambda x1, x2: _mock_kernel(x1, x2, []),
          assume_normalized_kernel=True,
          rescale_class_labels=True,
      )
  
      K1 = np.array(
          [
              [
                  1,
                  0.2,
                  0.2,
              ],
              [0.2, 1, 0.2],
              [0.2, 0.2, 1],
          ]
      )
      _Y = np.array([1 / 2, -1, 1 / 2])
      K2 = np.outer(_Y, _Y)
      expected_alignment = np.trace(np.dot(K1, K2)) / math.sqrt(
          np.trace(np.dot(K1, K1)) * np.trace(np.dot(K2, K2))
      )
  
      assert alignment == expected_alignment
      assert alignment == alignment_assume
  
imports: import math
  import sys
  from functools import partial
  import pytest
  import numpy
  import pennylane
  import pennylane.kernels
  from pennylane import numpy
label_desc: Use image node_id 6 for calling the TestKernelTargetAlignment obj's underlying member method code with example usage: obj.test_alignment_value_with_normalization() without return types