code: def _kde_adaptive(
      x,
      bw,
      grid_edges,
      grid_counts,
      grid_len,
      bound_correction,
      **kwargs,
  ):
      """Compute Adaptive Kernel Density Estimation.
  
      One dimensional adaptive Gaussian kernel density estimation. The implementation uses the binning
      technique. Since there is not an unique `bw`, the convolution is not possible. The alternative
      implemented in this function is known as Abramson's method.
      This is an internal function used by `kde()`.
      """
      # Pilot computations used for bandwidth adjustment
      pilot_grid, pilot_pdf = _kde_convolution(
          x, bw, grid_edges, grid_counts, grid_len, bound_correction
      )
  
      # Adds to avoid np.log(0) and zero division
      pilot_pdf += 1e-9
  
      # Determine the modification factors
      pdf_interp = np.interp(x, pilot_grid, pilot_pdf)
      geom_mean = np.exp(np.mean(np.log(pdf_interp)))
  
      # Power of c = 0.5 -> Abramson's method
      adj_factor = (geom_mean / pilot_pdf) ** 0.5
      bw_adj = bw * adj_factor
  
      # Estimation of Gaussian KDE via binned method (convolution not possible)
      grid = pilot_grid
  
      if bound_correction:
          grid_npad = int(grid_len / 5)
          grid_width = grid_edges[1] - grid_edges[0]
          grid_pad = grid_npad * grid_width
          grid_padded = np.linspace(
              grid_edges[0] - grid_pad,
              grid_edges[grid_len - 1] + grid_pad,
              num=grid_len + 2 * grid_npad,
          )
          grid_counts = np.concatenate(
              [
                  grid_counts[grid_npad - 1 :: -1],
                  grid_counts,
                  grid_counts[grid_len : grid_len - grid_npad - 1 : -1],
              ]
          )
          bw_adj = np.concatenate(
              [
                  bw_adj[grid_npad - 1 :: -1],
                  bw_adj,
                  bw_adj[grid_len : grid_len - grid_npad - 1 : -1],
              ]
          )
          pdf_mat = (grid_padded - grid_padded[:, None]) / bw_adj[
              :, None
          ]
          pdf_mat = np.exp(-0.5 * pdf_mat**2) * grid_counts[:, None]
          pdf_mat /= (2 * np.pi) ** 0.5 * bw_adj[:, None]
          pdf = np.sum(
              pdf_mat[:, grid_npad : grid_npad + grid_len], axis=0
          ) / len(x)
  
      else:
          pdf_mat = (grid - grid[:, None]) / bw_adj[:, None]
          pdf_mat = np.exp(-0.5 * pdf_mat**2) * grid_counts[:, None]
          pdf_mat /= (2 * np.pi) ** 0.5 * bw_adj[:, None]
          pdf = np.sum(pdf_mat, axis=0) / len(x)
  
      return grid, pdf
  
imports: import warnings
  import numpy
  from scipy.fftpack import fft
  from scipy.optimize import brentq
  from scipy.signal import convolve, convolve2d, gaussian
  from scipy.sparse import coo_matrix
  from scipy.special import ive
  from ..utils import _cov, _dot, _stack, conditional_jit
label_desc: Use image node_id 19 for calling a global function with example usage: _kde_adaptive(x, bw, grid_edges, grid_counts, grid_len, bound_correction) and returns: grid,  pdf