code: def kde_sklearn(data, grid, **kwargs):
      
      kde_skl = KernelDensity(**kwargs)
      kde_skl.fit(data)
      # score_samples() returns the log-likelihood of the samples
      log_pdf = kde_skl.score_samples(grid)
      return np.exp(log_pdf)
docs: Kernel Density Estimation with Scikit-learn
  
      Parameters
      ----------
      data : numpy.array
          Data points used to compute a density estimator. It
          has `n x p` dimensions, representing n points and p
          variables.
      grid : numpy.array
          Data points at which the desity will be estimated. It
          has `m x p` dimensions, representing m points and p
          variables.
  
      Returns
      -------
      out : numpy.array
          Density estimate. Has `m x 1` dimensions