Hi I would like to group a set of numbers by their spatial distance and since it is a 1D problem, I want to use KernelDensity. Based on the examples I saw in the internet [1], the following code, works:
a = array([1,2,3,10,12,11,50,51,52,53]).reshape(-1, 1) kde = KernelDensity(kernel='gaussian').fit(a) s = linspace(0,100) e = kde.score_samples(s.reshape(-1,1)) mi = argrelextrema(e, np.less)[0] With the code, I am able to find the minima of the KDE and then compare the values in `a` with `s[mi]`. For simple and test file, that works. However, I need some more information about the way it works. For example, if I change the linespace boundries, the result changes. What does the linespace do exactly? [1] https://scikit-learn.org/stable/auto_examples/neighbors/plot_kde_1d.html Regards, Mahmood _______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn