# How to map 2 vectors on the hyper plane to a similarity metric?

I am working on a face recognition application and one of the features I want to include is to compare if two pictures of $2$ people is the same. I have written code (Convoluted neural network) to align and extract feature vectors of two pictures and represent the two faces as $n$ dimensional feature vectors $p,q$ on the unit hyper plane. Right now, I am calculating the squared Euclidean distance between the $2$ vectors $d(p,q)^2\in [0,4]$ (Since its a unit hyper plane).

I ran a few tests on a set of $10,000$ image pairs of same people and $10,000$ image pairs of different pairs and found that the mean cutoff square distance to distinguish same people and different people was $0.99 +- 0.02$.

Now my question is, I am trying to find a similarity function such as $\frac{1}{1+dist(p,q)^2}$ or $\frac{1}{e^{dist(p,q)^2}}$ that will be very sensitive near $0.99+-0.5$ and maps the $dist(p,q)^2\in [0,4]$ to the unit interval $[0,1]$. By sensitive near $0.99$, I mean it should match $0.99$ to roughly $0.5$ and for any $x\in \{0.9+-0.5\}$, it should five a big 'spread'. Obviously, another feature is that it maps the $0$ distance to $1$ and the $4$ distance to $0$.

How do I generate such function?

• You can make up whatever function you like, but I doubt it will help with whatever larger task you are interested in. It's not like you get more information from the data by doing this transformation. – Dave Kielpinski Oct 18 '17 at 17:26