def kde_KL_divergence_1d(x, y, h, nb_bins=1000, fft=True):
    min_ = np.min([np.min(x), np.min(y)])
    max_ = np.max([np.max(x), np.max(y)])
    (grid, kde_x) = gaussian_kde_1d(x, h,
            nb_bins=nb_bins,
            fft=fft,
            bounds=(min_, max_)
            )
    (grid2, kde_y) = gaussian_kde_1d(y, h,
            nb_bins=nb_bins,
            fft=fft,
            bounds=(min_, max_)
            )
    delta = grid[1] - grid[0]
    plogp = - kde_x * np.log((kde_x + EPSILON) / (kde_y + EPSILON))
    # Integrate
    div = trapz(plogp, dx=delta)
    return div
Uses Kernel Density Estimator with Gaussian kernel on one
dataset/ETHPy150Open omangin/multimodal/multimodal/lib/kde1d.py/kde_KL_divergence_1d