I'm using a KD-estimation with a custom metric. The metric is obviously slower than the builtin euclidean distance, but works fine. When doing
kde=KernelDensity(...)
kde.fit(X)
I get results in a reasonable amount of time.
When I then calculate
surface=np.exp(kde.score_samples(meshgrid))
where mehsgrid is a numpy array of the size (about) 64000x2, kde calculates the distance on each point in the grid. I seem to bascially misunderstand why that's necessary... The density is already calculated with the .fit() method, and score_samples "should" simply evaluate the density on each point in the grid - right? Do I overlook something?
Whe I do all the calculations with the builtin euclidean metric, the computation is fairly fast, no hint that .score_samples would iterate over gazillions of points...
Any hint is appreciated.