Formally describe a similarity function

52 Views Asked by At

I have a function that takes two real world objects as input and returns a real value between 0 and 1 as the similarity of the two objects. How to formally describe this function in mathematical language? I am looking for something like $f: \mathbb{R} \rightarrow \mathbb{R}$

1

There are 1 best solutions below

1
On

Encode the two objects into feature vectors of length $n$, call them $x$ and $y$.

Suppose you have two vectors, $x, y$ where they are componentwise nonnegative.

One possible approach to use Jaccard similarity coefficient.

$$J(x,y)=\frac{\sum_{i=1}^n \min(x_i, y_i)}{\sum_{i=1}^n \max{x_i, y_i}}$$

For the case of binary vectors.

Let $M_{11}$ represents the total number of attributes where $x$ and $y$ both have a value of $1$.

Let $M_{01}$ represents the total number of attributes where the attribute of $x$ is $0$ and the attribute of $y$ is $1$.

Let $M_{10}$ represents the total number of attributes where the attribute of $x$ is $1$ and the attribute of $y$ is $0$.

$$J(x,y)=\frac{M_{11}}{M_{10}+M_{01}+M_{11}}$$

You can read more about Jaccard similarity here