Learning Paradigms - ML Strategy Selection Guide
Strategic guide for selecting machine learning paradigms when dealing with data constraints: self-supervised learning, few-shot learning, weak supervision, transfer learning, and meta-learning.
Overview
Modern machine learning extends beyond traditional supervised learning. This skill helps you choose the right learning paradigm based on your data characteristics, labeling resources, and deployment constraints.
Key covered paradigms:
- Self-Supervised Learning (SSL): Learn from abundant unlabeled data
- Few-Shot Learning (FSL): Classify with 1-10 labeled examples per class
- Weak Supervision: Leverage imperfect, incomplete, or noisy labels
- Transfer Learning: Adapt pretrained models to new domains
- Meta-Learning: Learn to learn across tasks
This skill synthesizes insights from recent research in audio classification, computer vision, and NLP to provide domain-agnostic guidance applicable to R, Python, or Julia implementations.
When This Skill Activates
Use this skill when:
- Starting a project with limited labeled data
- Facing annotation bottlenecks or high labeling costs
- Working with rare classes or long-tailed distributions
- Building systems for understudied domains (e.g., bioacoustics, medical imaging)
- Deciding between SSL pretraining vs direct supervised learning
- Combining multiple learning paradigms (e.g., SSL + FSL)
- Evaluating if weak supervision can replace full annotation
The Five Paradigms
1. Self-Supervised Learning (SSL)
What it is:
Pretraining on unlabeled data by solving pretext tasks (contrastive learning, masked prediction, reconstruction) to learn useful representations.
When to use:
- ✅ Abundant unlabeled data available (1000s-millions of samples)
- ✅ Expensive or slow to label data
- ✅ Need domain-specific representations (pretrained models don't transfer well)
- ✅ Can define meaningful augmentations or pretext tasks
When NOT to use:
- ❌ Very small datasets (< 1000 samples) - not enough for SSL pretraining
- ❌ Task is fundamentally different from pretext task
- ❌ Strong pretrained models already exist and transfer well
Common techniques:
- Contrastive learning: SimCLR, MoCo, Barlow Twins
- Masked prediction: MAE (images), BERT (text)
- Consistency regularization: FixMatch, UDA
R ecosystem support:
{torch} + {luz}: Custom SSL implementation
{keras3}: Contrastive learning with Keras
- Limited native packages - often requires Python interop via
{reticulate}
Expected gain: 5-20% accuracy improvement on downstream tasks with limited labels.
2. Few-Shot Learning (FSL)
What it is:
Learning to classify new classes from 1-10 labeled examples per class (N-way K-shot), typically via metric learning or meta-learning.
When to use:
- ✅ New classes emerge frequently (e.g., new species, products)
- ✅ Cannot collect many labeled examples per class
- ✅ Need rapid adaptation to new categories
- ✅ Have related tasks for meta-training
When NOT to use:
- ❌ Can collect 50+ labeled examples per class - standard supervised learning works better
- ❌ Classes are very similar (inter-class similarity high) - hard to discriminate with few shots
- ❌ No related tasks for meta-training
Common techniques:
- Metric learning: Prototypical Networks, Matching Networks, Siamese Networks
- Meta-learning: MAML, Reptile
- Data augmentation: Mixup, CutMix in feature space
R ecosystem support:
{torch}: Manual implementation of prototypical networks
- No native meta-learning frameworks - Python (learn2learn, torchmeta) dominates
Expected performance: 40-70% accuracy on 5-way 5-shot tasks (domain-dependent).
3. Weak Supervision
What it is:
Training with imperfect labels: noisy labels, incomplete labels (only clip-level, not frame-level), or labels from multiple annotators with disagreements.
When to use:
- ✅ Labels exist but are imperfect (crowdsourced, automatically generated)
- ✅ Fine-grained labels too expensive (e.g., temporal boundaries in audio)
- ✅ Multiple overlapping events (e.g., bird chorus - know species present, not when)
- ✅ Can use rule-based heuristics or domain knowledge as weak labels
When NOT to use:
- ❌ Can afford clean labels - clean data always better
- ❌ Noise rate > 40% - model may memorize noise
- ❌ No validation set with clean labels - can't evaluate properly
Common techniques:
- Multiple Instance Learning (MIL): Treat recordings as bags
- Attention pooling: Learn which frames are relevant
- Noise-robust losses: Symmetric cross-entropy, bootstrapping
- Label smoothing: Reduce overconfidence
R ecosystem support:
{milr}: Multiple instance learning (basic support)
{torch}: Custom attention mechanisms
- Better supported in Python (snorkel, weakly)
Expected robustness: Tolerates 20-30% label noise with proper techniques.
4. Transfer Learning
What it is:
Reusing knowledge from a pretrained model (trained on large source task) and adapting to target task via fine-tuning or feature extraction.
When to use:
- ✅ Limited target data (< 1000 labeled examples)
- ✅ Good pretrained model exists for related domain
- ✅ Target task shares structure with source task
- ✅ Computational budget allows fine-tuning
When NOT to use:
- ❌ Source and target domains are very different (e.g., ImageNet → medical histology)
- ❌ Target data is abundant (10k+ labeled examples) - train from scratch often better
- ❌ Pretrained model is too large for deployment
Common techniques:
- Feature extraction: Freeze pretrained layers, train only classifier
- Fine-tuning: Update all or top layers with small learning rate
- Domain adaptation: Align distributions between source and target
R ecosystem support:
{keras3}: Excellent - direct access to pretrained models (ResNet, EfficientNet, BERT)
{torch}: Good - torchvision models, easy fine-tuning
{tidymodels}: Integrates with pretrained embeddings
Expected gain: 10-30% accuracy improvement over training from scratch.
5. Meta-Learning
What it is:
Learning to learn: training on multiple related tasks to acquire a learning algorithm that adapts quickly to new tasks.
When to use:
- ✅ Have many related tasks (e.g., multiple datasets, multiple domains)
- ✅ Need fast adaptation to new tasks at test time
- ✅ Tasks share structure but differ in specifics
- ✅ Sufficient compute for meta-training
When NOT to use:
- ❌ Only one task available - no distribution of tasks to meta-learn from
- ❌ Tasks are unrelated (no shared structure)
- ❌ Limited compute - meta-learning is expensive
Common techniques:
- Optimization-based: MAML, Reptile (learn initialization)
- Metric-based: Prototypical Networks (learn embedding space)
- Model-based: Neural Turing Machines, Memory Networks
R ecosystem support:
- Very limited - requires manual implementation in
{torch}
- Python (PyTorch) strongly recommended for meta-learning
Expected benefit: 2-3× sample efficiency on new tasks after meta-training.
Decision Framework
Primary Decision Tree
START: What data constraints do you have?
├─ Abundant unlabeled data (1000s+) but few labels?
│ ├─ Yes → Consider SSL pretraining
│ │ ├─ Then fine-tune with few labels (SSL → Supervised)
│ │ └─ Or combine with FSL (SSL → FSL)
│ └─ No → Continue
│
├─ Very few labeled examples per class (< 10)?
│ ├─ Yes → Consider Few-Shot Learning
│ │ ├─ Have related tasks? → Meta-learning FSL
│ │ └─ No related tasks? → Transfer learning + FSL
│ └─ No → Continue
│
├─ Labels exist but are noisy/incomplete?
│ ├─ Yes → Consider Weak Supervision
│ │ ├─ Clip-level only? → Multiple Instance Learning
│ │ ├─ Noisy labels? → Noise-robust training
│ │ └─ Multiple annotators? → Aggregation + uncertainty
│ └─ No → Continue
│
├─ Pretrained model available for similar domain?
│ ├─ Yes → Transfer Learning (fine-tune or extract features)
│ └─ No → Train from scratch or SSL pretraining
│
└─ Multiple related tasks to leverage?
├─ Yes → Meta-learning
└─ No → Standard supervised learning
Combination Strategies
Paradigms often work better together:
| Combination |
Use Case |
Example |
| SSL → Supervised |
Unlabeled abundant, moderate labels |
Pretrain on 100k unlabeled, fine-tune on 1k labeled |
| SSL → FSL |
Unlabeled abundant, very few labels |
Pretrain on 50k unlabeled, 5-shot classify new classes |
| Transfer → FSL |
Pretrained model exists, few target labels |
Fine-tune ImageNet model with 10 shots per class |
| Weak → SSL |
Weak labels + unlabeled data |
Use weak labels as pretext task, refine with SSL |
| Meta-learning → FSL |
Many related FSL tasks |
Meta-train on 20 datasets, fast adapt to new dataset |
Implementation tip: Start simple (transfer learning), then add complexity (SSL, FSL) only if needed.
Paradigm Selection Cheat Sheet
| Scenario |
Recommended Paradigm |
R Support |
| 10k+ clean labels, standard task |
Supervised learning |
⭐⭐⭐⭐⭐ Excellent (tidymodels, mlr3) |
| 1k labels, pretrained model exists |
Transfer learning |
⭐⭐⭐⭐ Good (keras3, torch) |
| 100k unlabeled, 500 labeled |
SSL + supervised |
⭐⭐⭐ Moderate (torch custom) |
| 5-10 examples per class, new classes |
Few-shot learning |
⭐⭐ Limited (manual torch) |
| Clip-level labels, need frame-level |
Weak supervision (MIL) |
⭐⭐ Limited (milr, torch) |
| Noisy crowdsourced labels |
Weak supervision (robust) |
⭐⭐ Limited (torch custom) |
| Many related tasks, need adaptation |
Meta-learning |
⭐ Very limited (Python better) |
Legend:
- ⭐⭐⭐⭐⭐ Native R packages, production-ready
- ⭐⭐⭐⭐ Good support, may need some custom code
- ⭐⭐⭐ Moderate, requires
torch/keras3 + custom layers
- ⭐⭐ Limited, manual implementation required
- ⭐ Use Python via
{reticulate} or switch languages
Practical Examples
Example 1: Bioacoustics with Limited Labels
Scenario: Classify 50 frog species from 3-hour recordings. Have 10 labeled clips per species, 500 hours unlabeled.
Solution:
- SSL pretraining on 500 hours unlabeled (contrastive learning on mel-spectrograms)
- Weak supervision on 10 clips per species (clip-level labels, learn frame-level via attention)
- Few-shot evaluation for rare species (5-shot prototypical networks)
R implementation path:
{tuneR} + {torch} for audio preprocessing
- Custom SSL implementation with
{luz}
- Attention pooling for weak supervision
- Prototypical networks for FSL
Reference: See SSL+FSL combination pattern in examples/ssl-fsl-combination-pattern.md
Example 2: Medical Image Classification
Scenario: Detect rare disease from X-rays. 50 positive cases, 1000 negative cases, 100k unlabeled X-rays.
Solution:
- Transfer learning from ImageNet pretrained model (anatomy structure preserved)
- SSL pretraining on 100k unlabeled X-rays (adapt to medical domain)
- Class imbalance handling (focal loss, oversampling rare class)
R implementation path:
{keras3}: Load pretrained DenseNet/EfficientNet
- Fine-tune with frozen early layers, train classifier
- Use
{themis} for imbalance handling in {tidymodels}
Example 3: NLP with Crowdsourced Labels
Scenario: Sentiment classification with 5 annotators per text. 30% annotator disagreement.
Solution:
- Weak supervision with label aggregation (majority vote or probabilistic)
- Transfer learning from BERT pretrained model
- Uncertainty estimation to detect unreliable annotations
R implementation path:
{text} package for BERT embeddings
- Custom aggregation (weighted by annotator reliability)
{tidymodels} for classifier training
Guidelines for R Practitioners
When R is Sufficient
- Transfer learning with pretrained models (
{keras3}, {torch})
- Standard supervised learning with feature engineering
- Moderate-scale SSL (< 100k samples)
- Simple metric learning (prototypical networks)
When to Use Python Interop
- Advanced SSL techniques (MoCo, BYOL, VICReg)
- Meta-learning frameworks (MAML, Reptile)
- Complex weak supervision (Snorkel, data programming)
- Production-scale FSL (learn2learn, torchmeta)
Interop pattern:
library(reticulate)
use_condaenv("ml-paradigms")
# Python SSL/FSL training
py_run_file("train_ssl.py")
# Load embeddings back to R
embeddings <- py$load_embeddings()
# Continue in R with tidymodels
model <- logistic_reg() |>
fit(label ~ ., data = embeddings)
Recommended Workflow
- Prototype in R (if possible) to validate approach
- Switch to Python for paradigms with weak R support (meta-learning, advanced SSL)
- Return to R for downstream tasks (analysis, reporting, integration)
Common Pitfalls
SSL
- ❌ Insufficient data: SSL needs 10k+ samples to learn useful representations
- ❌ Poor augmentations: Augmentations must preserve semantics (e.g., don't flip bird calls vertically)
- ❌ No downstream evaluation: Always validate SSL embeddings on downstream task
FSL
- ❌ Not enough meta-training tasks: Need 20+ related tasks for effective meta-learning
- ❌ Overfitting to support set: Use episodic training to prevent memorization
- ❌ Ignoring class imbalance: FSL assumes balanced classes - preprocess accordingly
Weak Supervision
- ❌ No clean validation set: Need clean labels to evaluate and tune noise handling
- ❌ Trusting weak labels too much: Always treat as noisy, never as ground truth
- ❌ Ignoring label dependencies: Multi-label weak supervision harder than single-label
Transfer Learning
- ❌ Unfreezing too early: Let classifier train first before fine-tuning backbone
- ❌ Learning rate too high: Use 10-100× smaller LR for fine-tuning than training from scratch
- ❌ Domain mismatch ignored: If source ≠ target, consider domain adaptation techniques
Meta-Learning
- ❌ Single task meta-learning: Meaningless - need multiple related tasks
- ❌ Insufficient compute: Meta-learning is 10-100× more expensive than standard training
- ❌ Overengineering: Often transfer learning + fine-tuning works just as well
Evaluation Metrics by Paradigm
SSL
- Downstream accuracy: Classification accuracy after fine-tuning
- Linear probe accuracy: Train only linear classifier on frozen embeddings
- kNN accuracy: k-nearest neighbors in learned embedding space
- Embedding quality: t-SNE/UMAP visualization of class separation
FSL
- N-way K-shot accuracy: Standard FSL benchmark (e.g., 5-way 5-shot)
- Cross-domain generalization: Test on unseen domains
- Sample efficiency curve: Accuracy vs number of shots (1, 5, 10, 50)
Weak Supervision
- Clean test accuracy: Performance on fully labeled test set
- Label noise robustness: Accuracy vs noise rate (10%, 20%, 30%)
- Calibration: Expected Calibration Error (ECE) to check confidence
Transfer Learning
- Fine-tuning gain: Improvement over random initialization
- Convergence speed: Epochs to reach target accuracy
- Forgetting: Performance on source task after fine-tuning
Supporting Resources
Detailed References
- Complete paradigm taxonomy: references/learning-paradigms-taxonomy.md
- SSL+FSL combination pattern: examples/ssl-fsl-combination-pattern.md
- Paradigm selection flowchart: examples/paradigm-selection-flowchart.md
Key Papers by Paradigm
- SSL: "SimCLR: A Simple Framework for Contrastive Learning" (Chen et al., 2020)
- FSL: "Prototypical Networks for Few-shot Learning" (Snell et al., 2017)
- Weak Supervision: "Weakly Supervised Learning" (Zhou, 2018)
- Transfer Learning: "A Survey on Transfer Learning" (Pan & Yang, 2010)
- Meta-Learning: "Model-Agnostic Meta-Learning" (Finn et al., 2017)
R Packages by Paradigm
- SSL/FSL:
{torch}, {luz}, {keras3}
- Transfer:
{keras3}, {torch}, {tidymodels}
- Weak supervision:
{milr} (basic), custom {torch} implementations
Quick Reference Card
I have abundant unlabeled data + few labels
→ Self-Supervised Learning (SSL pretraining + fine-tuning)
I have 1-10 labeled examples per class
→ Few-Shot Learning (prototypical networks, meta-learning)
I have noisy or incomplete labels
→ Weak Supervision (MIL, attention pooling, noise-robust losses)
I have a pretrained model for a related task
→ Transfer Learning (fine-tune or extract features)
I have many related tasks to leverage
→ Meta-Learning (MAML, task-aware models)
I can combine multiple paradigms
→ Hybrid: SSL → FSL, Transfer → FSL, Weak → SSL
R support is limited for my paradigm
→ Use {reticulate} to call Python libraries, return to R for downstream work
When to Use This Skill
Invoke this skill when:
- Designing a new ML project with data constraints
- Stuck deciding between SSL, FSL, transfer learning
- Evaluating if weak supervision can reduce annotation costs
- Combining paradigms (e.g., "Should I do SSL before FSL?")
- Unsure if R ecosystem supports your chosen paradigm
- Need decision trees or cheat sheets for paradigm selection
This skill does NOT:
- Implement specific algorithms (that's for framework-specific skills)
- Provide detailed hyperparameter tuning (see
r-tidymodels or r-performance)
- Cover standard supervised learning (see
r-datascience, r-tidymodels)
1---2name: learning-paradigms3description: Machine learning paradigm selection guide covering self-supervised, few-shot, weak supervision, transfer learning and meta-learning. Use when mentions "self-supervised learning", "SSL", "few-shot learning", "FSL", "few shot", "weak supervision", "weakly supervised", "limited labeled data", "limited labels", "learning paradigms", "paradigmas de aprendizado", "meta-learning", "transfer learning", "quando usar SSL", "quando usar few-shot", "which learning approach", "escolher paradigma", "choose learning paradigm", "data scarcity", "escassez de dados", "unlabeled data", "dados não rotulados", or asks about learning strategy selection for data-limited scenarios.4---56# Learning Paradigms - ML Strategy Selection Guide78Strategic guide for selecting machine learning paradigms when dealing with data constraints: self-supervised learning, few-shot learning, weak supervision, transfer learning, and meta-learning.910## Overview1112Modern machine learning extends beyond traditional supervised learning. This skill helps you choose the right learning paradigm based on your data characteristics, labeling resources, and deployment constraints.1314**Key covered paradigms:**15- **Self-Supervised Learning (SSL)**: Learn from abundant unlabeled data16- **Few-Shot Learning (FSL)**: Classify with 1-10 labeled examples per class17- **Weak Supervision**: Leverage imperfect, incomplete, or noisy labels18- **Transfer Learning**: Adapt pretrained models to new domains19- **Meta-Learning**: Learn to learn across tasks2021This skill synthesizes insights from recent research in audio classification, computer vision, and NLP to provide domain-agnostic guidance applicable to R, Python, or Julia implementations.2223## When This Skill Activates2425Use this skill when:26- Starting a project with limited labeled data27- Facing annotation bottlenecks or high labeling costs28- Working with rare classes or long-tailed distributions29- Building systems for understudied domains (e.g., bioacoustics, medical imaging)30- Deciding between SSL pretraining vs direct supervised learning31- Combining multiple learning paradigms (e.g., SSL + FSL)32- Evaluating if weak supervision can replace full annotation3334## The Five Paradigms3536### 1. Self-Supervised Learning (SSL)3738**What it is:**39Pretraining on unlabeled data by solving pretext tasks (contrastive learning, masked prediction, reconstruction) to learn useful representations.4041**When to use:**42- ✅ Abundant unlabeled data available (1000s-millions of samples)43- ✅ Expensive or slow to label data44- ✅ Need domain-specific representations (pretrained models don't transfer well)45- ✅ Can define meaningful augmentations or pretext tasks4647**When NOT to use:**48- ❌ Very small datasets (< 1000 samples) - not enough for SSL pretraining49- ❌ Task is fundamentally different from pretext task50- ❌ Strong pretrained models already exist and transfer well5152**Common techniques:**53- Contrastive learning: SimCLR, MoCo, Barlow Twins54- Masked prediction: MAE (images), BERT (text)55- Consistency regularization: FixMatch, UDA5657**R ecosystem support:**58- `{torch}` + `{luz}`: Custom SSL implementation59- `{keras3}`: Contrastive learning with Keras60- Limited native packages - often requires Python interop via `{reticulate}`6162**Expected gain:** 5-20% accuracy improvement on downstream tasks with limited labels.6364---6566### 2. Few-Shot Learning (FSL)6768**What it is:**69Learning to classify new classes from 1-10 labeled examples per class (N-way K-shot), typically via metric learning or meta-learning.7071**When to use:**72- ✅ New classes emerge frequently (e.g., new species, products)73- ✅ Cannot collect many labeled examples per class74- ✅ Need rapid adaptation to new categories75- ✅ Have related tasks for meta-training7677**When NOT to use:**78- ❌ Can collect 50+ labeled examples per class - standard supervised learning works better79- ❌ Classes are very similar (inter-class similarity high) - hard to discriminate with few shots80- ❌ No related tasks for meta-training8182**Common techniques:**83- Metric learning: Prototypical Networks, Matching Networks, Siamese Networks84- Meta-learning: MAML, Reptile85- Data augmentation: Mixup, CutMix in feature space8687**R ecosystem support:**88- `{torch}`: Manual implementation of prototypical networks89- No native meta-learning frameworks - Python (learn2learn, torchmeta) dominates9091**Expected performance:** 40-70% accuracy on 5-way 5-shot tasks (domain-dependent).9293---9495### 3. Weak Supervision9697**What it is:**98Training with imperfect labels: noisy labels, incomplete labels (only clip-level, not frame-level), or labels from multiple annotators with disagreements.99100**When to use:**101- ✅ Labels exist but are imperfect (crowdsourced, automatically generated)102- ✅ Fine-grained labels too expensive (e.g., temporal boundaries in audio)103- ✅ Multiple overlapping events (e.g., bird chorus - know species present, not when)104- ✅ Can use rule-based heuristics or domain knowledge as weak labels105106**When NOT to use:**107- ❌ Can afford clean labels - clean data always better108- ❌ Noise rate > 40% - model may memorize noise109- ❌ No validation set with clean labels - can't evaluate properly110111**Common techniques:**112- Multiple Instance Learning (MIL): Treat recordings as bags113- Attention pooling: Learn which frames are relevant114- Noise-robust losses: Symmetric cross-entropy, bootstrapping115- Label smoothing: Reduce overconfidence116117**R ecosystem support:**118- `{milr}`: Multiple instance learning (basic support)119- `{torch}`: Custom attention mechanisms120- Better supported in Python (snorkel, weakly)121122**Expected robustness:** Tolerates 20-30% label noise with proper techniques.123124---125126### 4. Transfer Learning127128**What it is:**129Reusing knowledge from a pretrained model (trained on large source task) and adapting to target task via fine-tuning or feature extraction.130131**When to use:**132- ✅ Limited target data (< 1000 labeled examples)133- ✅ Good pretrained model exists for related domain134- ✅ Target task shares structure with source task135- ✅ Computational budget allows fine-tuning136137**When NOT to use:**138- ❌ Source and target domains are very different (e.g., ImageNet → medical histology)139- ❌ Target data is abundant (10k+ labeled examples) - train from scratch often better140- ❌ Pretrained model is too large for deployment141142**Common techniques:**143- Feature extraction: Freeze pretrained layers, train only classifier144- Fine-tuning: Update all or top layers with small learning rate145- Domain adaptation: Align distributions between source and target146147**R ecosystem support:**148- `{keras3}`: Excellent - direct access to pretrained models (ResNet, EfficientNet, BERT)149- `{torch}`: Good - torchvision models, easy fine-tuning150- `{tidymodels}`: Integrates with pretrained embeddings151152**Expected gain:** 10-30% accuracy improvement over training from scratch.153154---155156### 5. Meta-Learning157158**What it is:**159Learning to learn: training on multiple related tasks to acquire a learning algorithm that adapts quickly to new tasks.160161**When to use:**162- ✅ Have many related tasks (e.g., multiple datasets, multiple domains)163- ✅ Need fast adaptation to new tasks at test time164- ✅ Tasks share structure but differ in specifics165- ✅ Sufficient compute for meta-training166167**When NOT to use:**168- ❌ Only one task available - no distribution of tasks to meta-learn from169- ❌ Tasks are unrelated (no shared structure)170- ❌ Limited compute - meta-learning is expensive171172**Common techniques:**173- Optimization-based: MAML, Reptile (learn initialization)174- Metric-based: Prototypical Networks (learn embedding space)175- Model-based: Neural Turing Machines, Memory Networks176177**R ecosystem support:**178- Very limited - requires manual implementation in `{torch}`179- Python (PyTorch) strongly recommended for meta-learning180181**Expected benefit:** 2-3× sample efficiency on new tasks after meta-training.182183---184185## Decision Framework186187### Primary Decision Tree188189```190START: What data constraints do you have?191192├─ Abundant unlabeled data (1000s+) but few labels?193│ ├─ Yes → Consider SSL pretraining194│ │ ├─ Then fine-tune with few labels (SSL → Supervised)195│ │ └─ Or combine with FSL (SSL → FSL)196│ └─ No → Continue197│198├─ Very few labeled examples per class (< 10)?199│ ├─ Yes → Consider Few-Shot Learning200│ │ ├─ Have related tasks? → Meta-learning FSL201│ │ └─ No related tasks? → Transfer learning + FSL202│ └─ No → Continue203│204├─ Labels exist but are noisy/incomplete?205│ ├─ Yes → Consider Weak Supervision206│ │ ├─ Clip-level only? → Multiple Instance Learning207│ │ ├─ Noisy labels? → Noise-robust training208│ │ └─ Multiple annotators? → Aggregation + uncertainty209│ └─ No → Continue210│211├─ Pretrained model available for similar domain?212│ ├─ Yes → Transfer Learning (fine-tune or extract features)213│ └─ No → Train from scratch or SSL pretraining214│215└─ Multiple related tasks to leverage?216 ├─ Yes → Meta-learning217 └─ No → Standard supervised learning218```219220### Combination Strategies221222Paradigms often work better together:223224| Combination | Use Case | Example |225|-------------|----------|---------|226| **SSL → Supervised** | Unlabeled abundant, moderate labels | Pretrain on 100k unlabeled, fine-tune on 1k labeled |227| **SSL → FSL** | Unlabeled abundant, very few labels | Pretrain on 50k unlabeled, 5-shot classify new classes |228| **Transfer → FSL** | Pretrained model exists, few target labels | Fine-tune ImageNet model with 10 shots per class |229| **Weak → SSL** | Weak labels + unlabeled data | Use weak labels as pretext task, refine with SSL |230| **Meta-learning → FSL** | Many related FSL tasks | Meta-train on 20 datasets, fast adapt to new dataset |231232**Implementation tip:** Start simple (transfer learning), then add complexity (SSL, FSL) only if needed.233234---235236## Paradigm Selection Cheat Sheet237238| Scenario | Recommended Paradigm | R Support |239|----------|---------------------|-----------|240| 10k+ clean labels, standard task | **Supervised learning** | ⭐⭐⭐⭐⭐ Excellent (`tidymodels`, `mlr3`) |241| 1k labels, pretrained model exists | **Transfer learning** | ⭐⭐⭐⭐ Good (`keras3`, `torch`) |242| 100k unlabeled, 500 labeled | **SSL + supervised** | ⭐⭐⭐ Moderate (`torch` custom) |243| 5-10 examples per class, new classes | **Few-shot learning** | ⭐⭐ Limited (manual `torch`) |244| Clip-level labels, need frame-level | **Weak supervision (MIL)** | ⭐⭐ Limited (`milr`, `torch`) |245| Noisy crowdsourced labels | **Weak supervision (robust)** | ⭐⭐ Limited (`torch` custom) |246| Many related tasks, need adaptation | **Meta-learning** | ⭐ Very limited (Python better) |247248**Legend:**249- ⭐⭐⭐⭐⭐ Native R packages, production-ready250- ⭐⭐⭐⭐ Good support, may need some custom code251- ⭐⭐⭐ Moderate, requires `torch`/`keras3` + custom layers252- ⭐⭐ Limited, manual implementation required253- ⭐ Use Python via `{reticulate}` or switch languages254255---256257## Practical Examples258259### Example 1: Bioacoustics with Limited Labels260261**Scenario:** Classify 50 frog species from 3-hour recordings. Have 10 labeled clips per species, 500 hours unlabeled.262263**Solution:**2641. **SSL pretraining** on 500 hours unlabeled (contrastive learning on mel-spectrograms)2652. **Weak supervision** on 10 clips per species (clip-level labels, learn frame-level via attention)2663. **Few-shot evaluation** for rare species (5-shot prototypical networks)267268**R implementation path:**269- `{tuneR}` + `{torch}` for audio preprocessing270- Custom SSL implementation with `{luz}`271- Attention pooling for weak supervision272- Prototypical networks for FSL273274**Reference:** See SSL+FSL combination pattern in [examples/ssl-fsl-combination-pattern.md](examples/ssl-fsl-combination-pattern.md)275276---277278### Example 2: Medical Image Classification279280**Scenario:** Detect rare disease from X-rays. 50 positive cases, 1000 negative cases, 100k unlabeled X-rays.281282**Solution:**2831. **Transfer learning** from ImageNet pretrained model (anatomy structure preserved)2842. **SSL pretraining** on 100k unlabeled X-rays (adapt to medical domain)2853. **Class imbalance handling** (focal loss, oversampling rare class)286287**R implementation path:**288- `{keras3}`: Load pretrained DenseNet/EfficientNet289- Fine-tune with frozen early layers, train classifier290- Use `{themis}` for imbalance handling in `{tidymodels}`291292---293294### Example 3: NLP with Crowdsourced Labels295296**Scenario:** Sentiment classification with 5 annotators per text. 30% annotator disagreement.297298**Solution:**2991. **Weak supervision** with label aggregation (majority vote or probabilistic)3002. **Transfer learning** from BERT pretrained model3013. **Uncertainty estimation** to detect unreliable annotations302303**R implementation path:**304- `{text}` package for BERT embeddings305- Custom aggregation (weighted by annotator reliability)306- `{tidymodels}` for classifier training307308---309310## Guidelines for R Practitioners311312### When R is Sufficient313- Transfer learning with pretrained models (`{keras3}`, `{torch}`)314- Standard supervised learning with feature engineering315- Moderate-scale SSL (< 100k samples)316- Simple metric learning (prototypical networks)317318### When to Use Python Interop319- Advanced SSL techniques (MoCo, BYOL, VICReg)320- Meta-learning frameworks (MAML, Reptile)321- Complex weak supervision (Snorkel, data programming)322- Production-scale FSL (learn2learn, torchmeta)323324**Interop pattern:**325```r326library(reticulate)327use_condaenv("ml-paradigms")328329# Python SSL/FSL training330py_run_file("train_ssl.py")331332# Load embeddings back to R333embeddings <- py$load_embeddings()334335# Continue in R with tidymodels336model <- logistic_reg() |>337 fit(label ~ ., data = embeddings)338```339340### Recommended Workflow3411. **Prototype in R** (if possible) to validate approach3422. **Switch to Python** for paradigms with weak R support (meta-learning, advanced SSL)3433. **Return to R** for downstream tasks (analysis, reporting, integration)344345---346347## Common Pitfalls348349### SSL350- ❌ **Insufficient data**: SSL needs 10k+ samples to learn useful representations351- ❌ **Poor augmentations**: Augmentations must preserve semantics (e.g., don't flip bird calls vertically)352- ❌ **No downstream evaluation**: Always validate SSL embeddings on downstream task353354### FSL355- ❌ **Not enough meta-training tasks**: Need 20+ related tasks for effective meta-learning356- ❌ **Overfitting to support set**: Use episodic training to prevent memorization357- ❌ **Ignoring class imbalance**: FSL assumes balanced classes - preprocess accordingly358359### Weak Supervision360- ❌ **No clean validation set**: Need clean labels to evaluate and tune noise handling361- ❌ **Trusting weak labels too much**: Always treat as noisy, never as ground truth362- ❌ **Ignoring label dependencies**: Multi-label weak supervision harder than single-label363364### Transfer Learning365- ❌ **Unfreezing too early**: Let classifier train first before fine-tuning backbone366- ❌ **Learning rate too high**: Use 10-100× smaller LR for fine-tuning than training from scratch367- ❌ **Domain mismatch ignored**: If source ≠ target, consider domain adaptation techniques368369### Meta-Learning370- ❌ **Single task meta-learning**: Meaningless - need multiple related tasks371- ❌ **Insufficient compute**: Meta-learning is 10-100× more expensive than standard training372- ❌ **Overengineering**: Often transfer learning + fine-tuning works just as well373374---375376## Evaluation Metrics by Paradigm377378### SSL379- **Downstream accuracy**: Classification accuracy after fine-tuning380- **Linear probe accuracy**: Train only linear classifier on frozen embeddings381- **kNN accuracy**: k-nearest neighbors in learned embedding space382- **Embedding quality**: t-SNE/UMAP visualization of class separation383384### FSL385- **N-way K-shot accuracy**: Standard FSL benchmark (e.g., 5-way 5-shot)386- **Cross-domain generalization**: Test on unseen domains387- **Sample efficiency curve**: Accuracy vs number of shots (1, 5, 10, 50)388389### Weak Supervision390- **Clean test accuracy**: Performance on fully labeled test set391- **Label noise robustness**: Accuracy vs noise rate (10%, 20%, 30%)392- **Calibration**: Expected Calibration Error (ECE) to check confidence393394### Transfer Learning395- **Fine-tuning gain**: Improvement over random initialization396- **Convergence speed**: Epochs to reach target accuracy397- **Forgetting**: Performance on source task after fine-tuning398399---400401## Supporting Resources402403### Detailed References404- Complete paradigm taxonomy: [references/learning-paradigms-taxonomy.md](references/learning-paradigms-taxonomy.md)405- SSL+FSL combination pattern: [examples/ssl-fsl-combination-pattern.md](examples/ssl-fsl-combination-pattern.md)406- Paradigm selection flowchart: [examples/paradigm-selection-flowchart.md](examples/paradigm-selection-flowchart.md)407408### Key Papers by Paradigm409- **SSL**: "SimCLR: A Simple Framework for Contrastive Learning" (Chen et al., 2020)410- **FSL**: "Prototypical Networks for Few-shot Learning" (Snell et al., 2017)411- **Weak Supervision**: "Weakly Supervised Learning" (Zhou, 2018)412- **Transfer Learning**: "A Survey on Transfer Learning" (Pan & Yang, 2010)413- **Meta-Learning**: "Model-Agnostic Meta-Learning" (Finn et al., 2017)414415### R Packages by Paradigm416- SSL/FSL: `{torch}`, `{luz}`, `{keras3}`417- Transfer: `{keras3}`, `{torch}`, `{tidymodels}`418- Weak supervision: `{milr}` (basic), custom `{torch}` implementations419420---421422## Quick Reference Card423424**I have abundant unlabeled data + few labels**425→ Self-Supervised Learning (SSL pretraining + fine-tuning)426427**I have 1-10 labeled examples per class**428→ Few-Shot Learning (prototypical networks, meta-learning)429430**I have noisy or incomplete labels**431→ Weak Supervision (MIL, attention pooling, noise-robust losses)432433**I have a pretrained model for a related task**434→ Transfer Learning (fine-tune or extract features)435436**I have many related tasks to leverage**437→ Meta-Learning (MAML, task-aware models)438439**I can combine multiple paradigms**440→ Hybrid: SSL → FSL, Transfer → FSL, Weak → SSL441442**R support is limited for my paradigm**443→ Use `{reticulate}` to call Python libraries, return to R for downstream work444445---446447## When to Use This Skill448449Invoke this skill when:450- Designing a new ML project with data constraints451- Stuck deciding between SSL, FSL, transfer learning452- Evaluating if weak supervision can reduce annotation costs453- Combining paradigms (e.g., "Should I do SSL before FSL?")454- Unsure if R ecosystem supports your chosen paradigm455- Need decision trees or cheat sheets for paradigm selection456457This skill does NOT:458- Implement specific algorithms (that's for framework-specific skills)459- Provide detailed hyperparameter tuning (see `r-tidymodels` or `r-performance`)460- Cover standard supervised learning (see `r-datascience`, `r-tidymodels`)