Closed suhasghorp closed 1 year ago
If you want to do it as you sketch, do something like
from KDEpy import FFTKDE
import numpy as np
data = np.random.randn(100)
x, y = FFTKDE().fit(data)()
cumulative = np.cumsum(y) / np.sum(y)
sample_idx = np.random.choice(np.arange(len(cumulative)), size=10)
cumulative[sample_idx]
I think that should do the trick. Hope it helps. I don't have the capacity to provide detailed solutions. You'll have to look into how numpy and Python works.
Hello, I am new to KDE and KDEpy. I understand that KDE returns an empirical PDF for the data provided. I need to get a CDF from the PDF returned by KDEpy and then generate pseudo-samples for a Uniform distribution. I am basically trying to duplicate following R code which uses kcde fucntion from ks library.
Thank you.