Prototypical Network Few-Shot Classification
A prototypical network learns an embedding in which each class is represented by the mean (prototype) of a few labelled examples, and new examples are assigned to the nearest prototype. It is trained on many small episodes that imitate the few-shot task, so it can classify classes it has never seen from only a handful of examples.
프로토타입 네트워크는 각 범주를 소수의 표지된 예를 임베딩한 평균(프로토타입)으로 나타내고 새 예를 가장 가까운 프로토타입에 배정하도록 임베딩을 학습합니다. 퓨샷 과제를 흉내 낸 작은 에피소드로 학습하므로 처음 보는 범주도 몇 개의 예만으로 분류할 수 있습니다.
If I only have a few labelled examples of each new class, can a learned embedding classify them better than comparing raw features?
새 범주마다 표지된 예가 몇 개뿐일 때, 학습한 임베딩이 원래 특성을 그대로 비교하는 것보다 더 잘 분류하는지 알고 싶습니다.
The method trains a small fully connected embedding by episodes of n_way classes with k_shot support and query rows, using the softmax of negative squared distances to prototypes. By default whole classes are held out, and accuracy over evaluation episodes is reported with a 95% interval next to nearest class mean on the raw features and chance.
When to use Prototypical Network Few-Shot Classification
- You have many classes with few rows each, and new classes appear later.
- You want to test whether a learned metric generalises to unseen classes.
- Features are tabular measurements rather than images.
When to use something else
- Every class has plenty of labelled rows: use Random Forest
- Inputs are texts and a language model is available: use LLM Zero-Shot and Few-Shot Classification
- You want a learned distance for nearest-neighbour use on known classes: use k-Nearest Neighbours
Assumptions and requirements
- Classes form compact clusters in a learnable embedding
- Training and evaluation classes come from a similar domain
- Episodes are treated as independent for the interval
What the analysis reports
- Mean episode accuracy with 95% interval
- Nearest-class-mean baseline and difference
- Training loss curve
- Split, way, shot and query settings
How to report it
A prototypical network reached a mean [value]-way [value]-shot accuracy of [value] (95% CI [value] to [value]) on held-out classes, against [value] for nearest class mean.
Related methods
- k-Nearest Neighbours
- Nearest Shrunken Centroids
- LLM Zero-Shot and Few-Shot Classification
- Multi-Layer Perceptron (MLP)
How this method is validated
이 방법의 검증 근거
- Independent computation. 2 reference tests compare the results with scikit-learn and direct computations (formulas, enumeration or simulation).
독립 계산. scikit-learn·직접 계산(식·열거·모의실험) 대조 참조 시험 2건 통과.
Tolerances are relative differences (absolute differences for values near zero). R comparisons and reference tests are re-run before each release of the analysis engine.
허용오차는 상대 차이입니다(0 근처 값은 절대 차이). R 대조와 참조 시험은 분석 엔진을 배포할 때마다 다시 돌립니다.
Run Prototypical Network Few-Shot Classification on Quorant
- Data you need
- a table (CSV or Excel) with an outcome variable and predictor (feature) columns
- Price
- 600 credits for one analysis up to 10,000 rows (complexity level 4); larger or wider data costs more. Optional methodologist review: 2400 credits.
- Checking
- Compared with independent computations
- Before you pay
- A free pre-analysis diagnosis checks your data and gives an exact quote; nothing is deducted until you approve it.