code: def test_aampi_self_join_egress_KNN():
      m = 3
      for k in range(2, 4):
          for p in [1.0, 2.0, 3.0]:
              seed = np.random.randint(100000)
              np.random.seed(seed)
  
              n = 30
              T = np.random.rand(n)
  
              ref_mp = naive.aampi_egress(T, m, p=p, k=k)
              ref_P = ref_mp.P_.copy()
              ref_I = ref_mp.I_
              ref_left_P = ref_mp.left_P_.copy()
              ref_left_I = ref_mp.left_I_
  
              stream = aampi(T, m, egress=True, p=p, k=k)
  
              comp_P = stream.P_.copy()
              comp_I = stream.I_
              comp_left_P = stream.left_P_.copy()
              comp_left_I = stream.left_I_
  
              naive.replace_inf(ref_P)
              naive.replace_inf(ref_left_P)
              naive.replace_inf(comp_P)
              naive.replace_inf(comp_left_P)
  
              npt.assert_almost_equal(ref_P, comp_P)
              npt.assert_almost_equal(ref_I, comp_I)
              npt.assert_almost_equal(ref_left_P, comp_left_P)
              npt.assert_almost_equal(ref_left_I, comp_left_I)
  
              for i in range(34):
                  t = np.random.rand()
  
                  ref_mp.update(t)
                  stream.update(t)
  
                  comp_P = stream.P_.copy()
                  comp_I = stream.I_
                  comp_left_P = stream.left_P_.copy()
                  comp_left_I = stream.left_I_
  
                  ref_P = ref_mp.P_.copy()
                  ref_I = ref_mp.I_
                  ref_left_P = ref_mp.left_P_.copy()
                  ref_left_I = ref_mp.left_I_
  
                  naive.replace_inf(ref_P)
                  naive.replace_inf(ref_left_P)
                  naive.replace_inf(comp_P)
                  naive.replace_inf(comp_left_P)
  
                  npt.assert_almost_equal(ref_P, comp_P)
                  npt.assert_almost_equal(ref_I, comp_I)
                  npt.assert_almost_equal(ref_left_P, comp_left_P)
                  npt.assert_almost_equal(ref_left_I, comp_left_I)
  
              np.random.seed(seed)
              T = np.random.rand(n)
              T = pd.Series(T)
  
              ref_mp = naive.aampi_egress(T, m, p=p, k=k)
              ref_P = ref_mp.P_.copy()
              ref_I = ref_mp.I_
  
              stream = aampi(T, m, egress=True, p=p, k=k)
  
              comp_P = stream.P_.copy()
              comp_I = stream.I_
  
              naive.replace_inf(ref_P)
              naive.replace_inf(comp_P)
  
              npt.assert_almost_equal(ref_P, comp_P)
              npt.assert_almost_equal(ref_I, comp_I)
  
              for i in range(34):
                  t = np.random.rand()
  
                  ref_mp.update(t)
                  stream.update(t)
  
                  comp_P = stream.P_.copy()
                  comp_I = stream.I_
                  comp_left_P = stream.left_P_.copy()
                  comp_left_I = stream.left_I_
  
                  ref_P = ref_mp.P_.copy()
                  ref_I = ref_mp.I_
                  ref_left_P = ref_mp.left_P_.copy()
                  ref_left_I = ref_mp.left_I_
  
                  naive.replace_inf(ref_P)
                  naive.replace_inf(ref_left_P)
                  naive.replace_inf(comp_P)
                  naive.replace_inf(comp_left_P)
  
                  npt.assert_almost_equal(ref_P, comp_P)
                  npt.assert_almost_equal(ref_I, comp_I)
                  npt.assert_almost_equal(ref_left_P, comp_left_P)
                  npt.assert_almost_equal(ref_left_I, comp_left_I)
  
imports: import naive
  import numpy
  import numpy.testing
  import pandas
  import pytest
  from stumpy import aampi, config, core
label_desc: Use image node_id 16 for calling a global function with example usage: test_aampi_self_join_egress_KNN() without return types