
Can you tell friends apart even if they've changed a lot over time?
Image: Darko Kadvanj, student, CC BY-SA 3.0, via Wikimedia Commons
Can you tell friends apart even if they've changed a lot over time?
Imagine you have a photo album with pictures of your friends. Over time, some friends change their hairstyle, gain weight, or even grow older. You want to easily recognize them even if they look different.
Think of your friends' photos as points in a space. Triplet loss helps you place them closer together if they're the same person and farther apart if they're different people. It's like drawing invisible lines connecting friends' photos.
Example
You have three photos: A, B, and C. Photo A shows your friend Tom in his 20s, photo B shows Tom in his 30s, and photo C shows Tom in his 40s. Triplet loss helps you understand that photos A, B, and C are closer together than photo C and any other photo of a different person.
Remember this
Triplet loss ensures that photos of the same person stay close together, making it easier to recognize them even if they change over time.
Text adapted from Wikipedia, licensed under CC BY-SA 4.0.
Write the contrastive loss function for SimCLR
Contrastive loss function: L = (1/2N) Σ [max(0, margin - y_i * (z_i - z_j))^2 + max(0, y_i * (z_i - z_j) - margin)^2]
Cross-entropy
Cross-entropy loss equation: H(p, q) = -Σ(p(x) * log(q(x)))
PageRank
PageRank formula: PR(A) = (1-d) + d Σ(PR(C)/L(C))
Bayes' theorem
Bayes' theorem formula: P(A|B) = [P(B|A) * P(A)] / P(B)
Jensen–Shannon divergence
Jensen-Shannon divergence formula: D_JS(P||Q) = 1/2 * D_KL(P||(M)) + 1/2 * D_KL(Q||(M))
Distance transform
Manhattan distance formula: |x1 - x2| + |y1 - y2|
Swipe through 100 ML concepts daily
Open Pocket Polymath