# Distance between two clusters convert as amiliarty score

Hi @DaveK
How one can convert the distance between two clusters into a similarity score?

Best
Malik

Hi @malik,

this greatly depends on the chosen distance measure. For instance, in case your distance is naturally in the interval [0, 1] then you can simply calculate `1 - *distance*` to convert it to a similarity.

If your cluster distances are euclidean based, you could probably do something like mentioned here.

I.e.: 1/(1 + d(c1, c2)) where d(c1, c2) is the distance between cluster 1 and 2.

Cheers
David

4 Likes

Hi @DaveK
Thanks for your reply. Im using the “Distance Matrix Calculate” with the “Cosine” as the Distance Function.
What is the value of 1 mean ? and what about value of zero ?
I mean to ask what is the equation of the Cosine here ?

Best
Malik

Hi @malik,

unfortunately, the Distance Matrix Calculate node does not give further information about the distance measure in the node dialog. However, equivalently you can look at the Numeric Distances node. In its node dialog you can see a little `?` symbol at the left of the distance selection which gives more information on the distance measure. For cosine similarity the info says:

“The Cosine distance is a measure of orientation and not magnitude: two vectors with the same orientation have a Cosine similarity of 1, two vectors at 90° have a similarity of 0. Two vectors diametrically opposed have a similarity of -1. This implementation of a distance is 1 - cosine-similarity and can take the domain [0, 2].”

Hope that info helps.

Cheers
David

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.