code: def test_pearson_baseline_sim():
      """Tests for the pearson_baseline similarity."""
  
      yr = yr_global.copy()
  
      # shuffle every rating list, to ensure the order in which ratings are
      # processed does not matter (it's important because it used to be error
      # prone when we were using itertools.combinations)
      for _, ratings in yr.items():
          random.shuffle(ratings)
  
      global_mean = 3  # fake
      x_biases = np.random.normal(0, 1, n_x)  # fake
      y_biases = np.random.normal(0, 1, 5)  # fake (there are 5 ys)
      sim = sims.pearson_baseline(
          n_x, yr, 1, global_mean, x_biases, y_biases
      )
      # check symmetry and bounds. -1 <= pearson coeff <= 1
      for xi in range(n_x):
          assert sim[xi, xi] == 1
          for xj in range(n_x):
              assert sim[xi, xj] == sim[xj, xi]
              assert -1 <= sim[xi, xj] <= 1
  
      # Note: as sim now depends on baselines, which depend on both users and
      # items ratings, it's now impossible to test assertions such that 'as users
      # have the same ratings, they should have a maximal similarity'. Both users
      # AND common items should have same ratings.
  
      # pairs of users (0, 3), have no common items
      assert sim[0, 3] == 0
      assert sim[0, 4] == 0
  
      # ensure min_support is taken into account. Only users 1 and 2 have more
      # than 4 common ratings.
      sim = sims.pearson_baseline(
          n_x, yr, 4, global_mean, x_biases, y_biases
      )
      for i in range(n_x):
          for j in range(i + 1, n_x):
              if i != 1 and j != 2:
                  assert sim[i, j] == 0
  
imports: import random
  import numpy
  import surprise.similarities
label_desc: Use image node_id 4 for calling a global function with example usage: test_pearson_baseline_sim() without return types