tensorflow / ranking

Learning to Rank in TensorFlow
Apache License 2.0
2.74k stars 477 forks source link

Triplet losses : ranking loss #285

Closed arita37 closed 3 years ago

arita37 commented 3 years ago

Some questions on the new TF ranking version:

1) Is triplet losses considered as ranking losses ? 2) How does it “located” among pairwise and listwise losses ?

3) what about the impact of negative sampler ?

xuanhuiwang commented 3 years ago

Triplet loss can be thought as a ranking loss or pairwise ranking loss. The main difference is conceptually: ranking loss deals with queries and documents, distance(q, d+) < distance(q, d-) while triplet loss deals with the same type of items, like documents and documents, distance(d, d+) < distance(d, d-).

Essentially, if we use items as queries, then they become more or less equivalent mathematically. You can extend to listwise ranking losses based on the above connection.

For traditional ranking problems, both positives and negatives are usually presented. I think the negative sampler is needed when there are only positive ones. The implementation of negative samplers can be different, but loss computation should be almost similarly for ranking losses or triplet losses.

In another word, ranking losses include more variants than triplet losses.

xuanhuiwang commented 3 years ago

close this by now and feel free to ropen.