To achieve this, we use metric learning to train the desirable embeddings.
let r i and r j be the feature representations of instances i and j, respectively, then the Euclidean distance between them is defined as , where d is the dimension of the feature representation.