kernel density score VS score_samples python scikit

kernel-density, python, scikit-learn

Solution

score() uses score_samples() as follows:

return np.sum(self.score_samples(X))

So, that's why you should use score_samples() in your case.

Problem

I am using scikit learn and python for a few days now and more specially KernelDensity. Once the model is fitted I would like to evaluate the probability of new points. The method score() is made for this but apparently doesn't work as when I put an array as entry 1 number is the output. I use score_samples() but it is very slow. I think that score is not working but I don't have skills to imrpove it. Please let me know if you have any idea

Original source