What's the correct objective function for cosine similarity of two vectors to be 1 or 0?

The representation learning model produces vectors for objects. I want the cosine similarity of some vector pairs to be (close to) 1, some to be 0. What objective function should I use? MSE as training a regression model?

Topic machine-learning

Category Data Science


There are a wide variety of loss metrics to compare two vectors (e.g., Triplet loss, Lifted Structure Loss, N-Pair loss, and Angular Loss).

Cosine distance (1-cosine similarity) can be used. Typically, a loss metrics needs to be minimized so distances metrics should be used.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.