keyword
contrastive loss function
A contrastive loss function is a machine learning objective function used in distance metric learning to map data into an embedding space where similar items are placed close together and dissimilar items are pushed apart. Operating on pairs of input samples, it calculates a penalty based on their geometric distance in the feature space. For similar pairs, the function penalizes large distances to pull their representations together, whereas for dissimilar pairs, it penalizes representations that fall within a specified margin, enforcing separation. This formulation enables neural networks to learn invariant, low-dimensional representations based on relative relationships rather than explicit coordinate labels, allowing the model to accurately evaluate similarity for new and unseen inputs.
1 item

