code: def compute_kernel_naive(Y, X, kernel, metric, h, sample_weight):
      d = skl_pairwise_distances(Y, X, metric)
      norm = kernel_norm(h, X.shape[1], kernel)
  
      if kernel == "gaussian":
          k = np.exp(-0.5 * (d * d) / (h * h))
      elif kernel == "tophat":
          k = d < h
      elif kernel == "epanechnikov":
          k = (1.0 - (d * d) / (h * h)) * (d < h)
      elif kernel == "exponential":
          k = np.exp(-d / h)
      elif kernel == "linear":
          k = (1 - d / h) * (d < h)
      elif kernel == "cosine":
          k = np.cos(0.5 * np.pi * d / h) * (d < h)
      else:
          raise ValueError("kernel not recognized")
      return norm * np.average(k, -1, sample_weight)
  
file_path: cuml/python/cuml/tests/test_kernel_density.py
imports: from cuml.testing.utils import as_type
  from sklearn.model_selection import GridSearchCV
  import pytest
  from hypothesis.extra.numpy import arrays
  from hypothesis import given, settings, assume, strategies
  from cuml.neighbors import KernelDensity, VALID_KERNELS, logsumexp_kernel
  from cuml.common.exceptions import NotFittedError
  from sklearn.metrics import pairwise_distances
  from sklearn.neighbors._ball_tree import kernel_norm
  from cuml.internals.safe_imports import cpu_only_import
label_desc: Use image node_id 1 for calling a global function with example usage: compute_kernel_naive(Y, X, kernel, metric, h, sample_weight) and returns: unknown