Course contentsShow
← Machine Learning and Deep Learning
Lesson 2600 of 3,53856. Few-Shot and Meta-LearningFree lesson

Prototypical Networks

Understand how class prototypes computed from support examples enable classification via nearest-centroid decision.

Prototypical Networks

What you'll learn: How Prototypical Networks classify new examples by computing class prototypes from support examples and using nearest-centroid decisions.

The Core Idea

Prototypical Networks solve few-shot classification by creating a prototype (representative point) for each class in an embedding space. Given a support set with labeled examples, the network:

  1. Embeds all support examples using a learned embedding function
  2. Computes the mean embedding (centroid) for each class — this is the prototype
  3. Classifies query examples by finding which prototype they're nearest to

Think of it like this: if you see 5 photos of cats and 5 of dogs, you mentally create an "average cat" and "average dog" concept. When shown a new animal, you decide which average it's closer to.

How It Works

For each class c, the prototype is simply:

prototype_c = mean(embeddings of all support examples in class c)

To classify a query example q:

  1. Embed it: embedding_q = f(q)
  2. Compute distances to all prototypes (typically Euclidean distance)
  3. Assign the class of the nearest prototype

The model is trained end-to-end by minimizing classification loss, which encourages the embedding function to create spaces where same-class examples cluster together.

Why This Matters

Unlike Siamese or Relation Networks that compare pairs, Prototypical Networks are efficient: you only compute N prototypes for N classes, not pairwise comparisons. The nearest-centroid rule is simple yet powerful, making the approach both interpretable and scalable.

Key Takeaway: Prototypical Networks classify by computing class prototypes as mean embeddings of support examples, then assigning queries to the nearest prototype — a simple, elegant approach to few-shot learning.