explosion / thinc

🔮 A refreshing functional take on deep learning, compatible with your favorite libraries
https://thinc.ai
MIT License
2.82k stars 275 forks source link

Triplet loss implementation #500

Open amirj opened 3 years ago

amirj commented 3 years ago

For a use case, I'm interested to use triplet/hinge loss, looking at the implementation of different losses in Thinc, I can't see something similar. Though there are various implementation in TensorFlow or PyTorch, it's not clear to me how can I leverage them to implement get_grad and get_loss functions.

kadarakos commented 2 years ago

Hey @amirj,

Sorry for the late reply! Currently we do not support the Triplet loss, but you could try out L2Distance and CosineDistance losses. Both losses are applicable in the scenario where you are trying to map two spaces onto the same one. Does this help?