code: def test_ei():
      rng = np.random.default_rng(123)
      for mean, var in [(0, 1), (-4, 9)]:
          thresholds = np.arange(-5, 5, 0.25) * np.sqrt(var) + mean
  
          v_n = [
              crit.EI_gaussian_empirical(mean, var, thresh, rng, 10000)
              for thresh in thresholds
          ]
          v_a = [
              crit.EI_gaussian(mean, var, thresh)
              for thresh in thresholds
          ]
  
          # import matplotlib.pyplot as plt
          # plt.plot(thresholds, v_n)
          # plt.plot(thresholds, v_a)
          # plt.show()
  
          if not np.allclose(v_n, v_a, atol=0.03, rtol=0.03):
              for t, n, a in zip(thresholds, v_n, v_a):
                  print(
                      (
                          t,
                          n,
                          a,
                          abs(n - a),
                          abs(n - a) / (abs(n) + abs(a)),
                      )
                  )
              assert 0
  
imports: import numpy
  import hyperopt.criteria
label_desc: Use image node_id 1 for calling a global function with example usage: test_ei() without return types