code: def test_linear(random_seed):
      """Tests that KernelExplainer returns the correct result when the model is linear.
  
      (as per corollary 1 of https://arxiv.org/abs/1705.07874)
      """
      rs = np.random.RandomState(random_seed)
      x = rs.normal(size=(200, 3), scale=1)
  
      # a linear model
      def f(x):
          return x[:, 0] + 2.0 * x[:, 1]
  
      phi = shap.KernelExplainer(f, x).shap_values(
          x, l1_reg="num_features(2)", silent=True
      )
      assert phi.shape == x.shape
  
      # corollary 1
      expected = (x - x.mean(0)) * np.array([1.0, 2.0, 0.0])
  
      np.testing.assert_allclose(expected, phi, rtol=1e-3)
  
file_path: shap/tests/explainers/test_kernel.py
imports: import numpy
  import pandas
  import scipy.sparse
  import sklearn
  import shap
label_desc: Use image node_id 12 for calling a global function with example usage: test_linear(random_seed) and returns: unknown