# Triplet loss function for face recognition?

In the Andrew-NG coursera course on Convnets he talked about triplet loss function for one shot face recognition.

The formula given in the video is, $$\to \small \small \small ||f(A)-f(P)||^2 \;+\;\alpha \leq\;||f(A)-f(N)||^2$$ $$\to \small \small \small D(A, P) + \alpha \leq D(A, N)$$ $$L(A,P,N) = max(||f(A)-f(P)||^2 - ||f(A)-f(N)||^2 + \alpha, 0)$$ Here, $$f(A) - \small \text{ Person }A$$ $$f(P) - \small \text{Different Picture of Person }A$$ $$F(N) - \small \text{Another Person}$$

I couldn't understand why did we use $$\alpha$$ in the formula. I understood that the ideal loss function is to decrease $$\small \small D(A, P)$$ and increase $$\small \small D(A, N)$$ but if we add $$\alpha$$ to $$\small \small D(A,P)$$ it will increase it which is not we require right?

$$\alpha$$ is known as the margin.
Not only that we want to minimize $$D(A,P)$$ and maximize $$D(A,N)$$, that is we want $$D(A,P)-D(A,N)$$ to be small. Not only that we want it to be non-positive, we want it to be sufficiently negative.
That is not only that we want $$D(A,P)-D(A,N) \le 0$$
We want $$D(A,P)-D(A,N) \le -\alpha.$$
• Analogy for maximization of score in exam: Your teacher might say do $50$ push up if you get a scoare that is below $50$ marks in your exam. But being a motivated learning, you can set the bar to be higher and say you will still do $50$ push up if you get a score that is below $75$, hence you will work harder to avoid the punishment. It is like a "standard" that you set. For our setting, we want to be sufficiently negative. Jul 12, 2019 at 6:32
• Thanks got it. What is the preferred value for $\alpha$? Jul 12, 2019 at 6:37