# Why do we use a Gaussian kernel as a similarity metric?

In graph-based clustering, why is it preferred to use the Gaussian kernel rather than the distance between two points as the similarity metric?

• I have an idea that for similarity, we want it to between 0and 1. Gaussian Kernel satisfies this and the weight becomes bigger when the distance between two points becomes bigger. Is there any other reason?
– zfb
Mar 4, 2017 at 1:04
• here you can watch a video which explain the function very well > coursera.org/lecture/machine-learning/… Oct 11, 2018 at 10:30

Let's be precise. "Distance" has lots of meanings in data science, I think you're talking about Euclidean distance.

The Gaussian kernel is a non-linear function of Euclidean distance.

• The kernel function decreases with distance and ranges between zero and one. In euclidean distance, the value increases with distance. Thus, the kernel function is a more useful metrics for weighting observations.

• The fact that it's bounded between zero and one is a nice property, whereas the absolute distance (it can be anything) in Euclidean distance can cause instability and difficulty in modelling.

• Euclidean distance (without the negative sign) is not a similarity measure, it's a distance function. The gaussian kernel is a similarity measure.

• You can think the Gaussian kernel like a normalization function for Euclidean distance.

• I also have another question about the σ in the expression. Does it have any meaning? In my opinion, I think it might be related to the scale of the clustering (for example, the radius a circular clustering).
– zfb
Mar 5, 2017 at 3:55
• @zfb It's a scaling parameter. The denominator can be written like a constant. Mar 5, 2017 at 3:56
• So how this scaling parameter affect the value of K(x, x') or the similarity? If it becomes bigger, then K(x,x') becomes bigger, can I say distance is being scaled smaller？ And in this case, we are looking at large scale clustering (for example, if the cluster is identified by circle, then the radius of the circlar should be big, or several points together are redifined to be aggregate "points", and then cluster those aggregated points ), rather than looking at a smaller one?
– zfb
Mar 5, 2017 at 4:08
• @zfb what is aggregate points? Jul 3, 2020 at 20:01

From the euclidian distance, you can derive many similarity meausures from kernel functions (polynomial, exponential, Matern, custom...), of which none is a priori better or worse than the gaussian kernel. It all depends on your data and what you expect.

Given a kernel function, you can also choose any definition of distance thats suits your feeling : weighted euclidian distance, $$L^1$$ norm, $$L^{\infty}$$ norm, earth mover's distance...

Now, the gaussian kernel with euclidian distance is very common as it is quite intuitive, and provides useful properties such as smoothness.

In Euclidian space where the axes are represented by $$i, j, k$$ vectors, three-dimensional space, the distance can be obtained by connecting the two points and finding the length of the connection. This space is used whenever the basis, each of directions, are independent. In other words, whenever it is needed to find the true distance, Euclidian distance can be employed if the features or variables, axes indeed, are independent. On the contrary, whenever the variables are correlated, the Euclidian distance cannot be employed, because the axes are not independent anymore. In such situations which is not rare, Mahalanobis can be utilised. Its form is like Gaussian distance.