[scikit-learn] Using KernelDensity for spatial clustering

2022-01-25 Thread Mahmood Naderan
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').

[scikit-learn] Using KernelDensity for spatial clustering

2022-01-25 Thread Mahmood
HiI 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(