How to correctly use an integral to model the density?

85 Views Asked by At

I have a density function $p_X(x)$ of an image $X \in \mathbb{R}^2$ over a set of points $x_i \in X$. If two points $x_i$ and $x_j$ are within a fixed distance of $\epsilon$ from each other, I want to connect them with an edge. We can find the euclidean distance of every two values BUT this is too slow so i want to create a continuous model to speed it up.

Firstly, define the density as

$$\rho_0 = \frac{1}{N} \sum_{i=1}^N\delta(X - x_i).$$

Convolve it with a scaled Gaussian Kernel, to get

$$\rho_X = \psi \circledast \rho_0 = \frac{1}{2N\epsilon^2 \pi} \sum_{i=1}^N e^{-\frac{(X-x_i)^2}{2\epsilon^2}}$$

My idea is then to integrate $p_X$ over a ball of size $\epsilon$ and centered at the point $x_i$, i.e. the probability $x_j$ is a distance of $\epsilon$ from $x_i$:

$$ \int_{D(\epsilon,x_i)} p_X dX= \frac{1}{2N\pi \epsilon^2} \int_{D(\epsilon,x_i)} \sum_{i=1}^N e^{-\frac{(x_1 - x_i)^2 + (x_2 - x_i)^2}{2\epsilon^2}} dx_1dx_2 \approx 0.39$$

If, $ \int_D p_X \ge C\epsilon^2$, then we join an edge between $x_i$ and any $x_j$ in this ball, since the probability they are close is high enough.

However, the result gives a constant so it would always be the same and hence useless to model. Should I integrate a different region and include $x_j$ somehow? But, say if I integrate each $x_i$ at a ball of size $x_j$, I do NOT want to compute the distance between every $x_i$ and $x_j$ as it defeats the purpose of why I'm doing this!