code: def test_pdf_boundary_simple(self):
      self.x_train = np.array([0])
      self.x_test = np.array([0, 1, 2, 3])
      for bw in [1e-3, 1e-2]:
          # note: for larger bandwidths, the pdf also needs to be truncated as +1,
          # which leads to something different than the scaling computed here
  
          hp_kernel1 = hp_kernels.WangRyzinOrdinal(
              data=self.x_train,
              bandwidth=bw,
              num_values=4,
              fix_boundary=False,
          )
          hp_kernel2 = hp_kernels.WangRyzinOrdinal(
              data=self.x_train,
              bandwidth=bw,
              num_values=4,
              fix_boundary=True,
          )
  
          hp_values1 = hp_kernel1(self.x_test).squeeze()
          hp_values2 = hp_kernel2(self.x_test).squeeze()
  
          weight = 1 - hp_values1[1:].sum()
          self.assertTrue(
              np.allclose(hp_values1 / weight, hp_values2, 1e-4)
          )
  
      self.x_train = np.array([3])
      self.x_test = np.array([0, 1, 2, 3])
      for bw in [1e-3, 1e-2]:
          # note: for larger bandwidths, the pdf also needs to be truncated as +1,
          # which leads to something different than the scaling computed here
  
          hp_kernel1 = hp_kernels.WangRyzinOrdinal(
              data=self.x_train,
              bandwidth=bw,
              num_values=4,
              fix_boundary=False,
          )
          hp_kernel2 = hp_kernels.WangRyzinOrdinal(
              data=self.x_train,
              bandwidth=bw,
              num_values=4,
              fix_boundary=True,
          )
  
          hp_values1 = hp_kernel1(self.x_test).squeeze()
          hp_values2 = hp_kernel2(self.x_test).squeeze()
  
          weight = 1 - hp_values1[:-1].sum()
          self.assertTrue(
              np.allclose(hp_values1 / weight, hp_values2, 1e-4)
          )
  
      # simple test based on 68, 95, 99% rule
      self.x_train = np.array([0.5])
      for bw, w in ([0.5, 0.6827], [0.25, 0.9545], [1 / 6, 0.9973]):
          hp_kernel = hp_kernels.Gaussian(
              data=self.x_train, bandwidth=bw, fix_boundary=True
          )
          self.assertAlmostEqual(
              hp_kernel.weights[0], 1 / w, delta=1e-4
          )
  
imports: import os
  import unittest
  import numpy
  from scipy.integrate import quad
  from statsmodels.nonparametric import kernels
  from hpbandster.optimizers.kde import kernels
  import ConfigSpace
  from pdb import set_trace
label_desc: Use image node_id 4 for calling the Test1dOrdinal obj's underlying member method code with example usage: obj.test_pdf_boundary_simple() without return types