I have a Gaussian Kernel with 100,000 points, that fits some kind of probability distribution. However, I am having trouble evaluate points on the Kernel. For example, let's say I have a 2D Gaussian Kernel setup on 100,000 2D vectors. Now, I have a point (1, 1). I would like to evaluate this on the Kernel. However, it is very slow, and the Kernel function has to be evaluated 100,000 times to get my result.
Is there a way to evaluate a Gaussian Kernel setup on this many points in a quicker way? Here is my current method for doing so, below. h is the bandwidth, and initial_points is an array of Vectors. I would like to do this preferably in Java.
public double evaluate_kernel(Vector x) {
double result = 0;
for (Vector v : initial_points) {
result += gaussian.evaluate(v - x, 1/h);
}
return result;
}