6
4
3
1
0
9
3
5
6
5
8
2
0
7
3
4
9
4
6
7
4
6
4
3
1
0
9
3
5
6
5
8
2
0
7
3
4
9
4
6
7
4
6
4
3
1
0
9
3
5
6
5
8
2
0
7
3
4
9
4
6
7
4
6
4
3
1
0
9
3
5
6
5
8
2
0
7
3
4
9
4
3
1
0
9
3
5
6
5
8
2
0
7
3
4
9
4
6
7
4
6
4
3
1
0
9
3
5
6
5
8
2
0
7
3
4
9
4
6
7
4
6
4
3
1
0
9
3
5
6
5
8
2
0
7
3
4
9
4
6
7
4
6
4
3
1
0
9
3
5
6
5
8
2
0
7
3
4
9
(contrastive learning)
dDŒ
1
Define Pairs
Collect or generate pairs of similar and dissimilar examples within your dataset. These pairs serve as the foundation for teaching the model what should be close or far apart in its learned representation space.
2
Embed Data
Pass each example pair through a neural network to create embeddings (representations) that capture essential features. The network learns to embed similar pairs close together and dissimilar pairs further apart.
3
Optimize Loss
Use a contrastive loss function (e.g., triplet or contrastive loss) to guide the network, reinforcing that similar embeddings remain close and dissimilar embeddings stay distinct, improving clustering and classification in downstream tasks.
➤