From r-skills
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.
How this skill is triggered — by the user, by Claude, or both
Slash command
/r-skills:learning-paradigmsThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
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.
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.
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:
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.
Use this skill when:
What it is: Pretraining on unlabeled data by solving pretext tasks (contrastive learning, masked prediction, reconstruction) to learn useful representations.
When to use:
When NOT to use:
Common techniques:
R ecosystem support:
{torch} + {luz}: Custom SSL implementation{keras3}: Contrastive learning with Keras{reticulate}Expected gain: 5-20% accuracy improvement on downstream tasks with limited labels.
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:
When NOT to use:
Common techniques:
R ecosystem support:
{torch}: Manual implementation of prototypical networksExpected performance: 40-70% accuracy on 5-way 5-shot tasks (domain-dependent).
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:
When NOT to use:
Common techniques:
R ecosystem support:
{milr}: Multiple instance learning (basic support){torch}: Custom attention mechanismsExpected robustness: Tolerates 20-30% label noise with proper techniques.
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:
When NOT to use:
Common techniques:
R ecosystem support:
{keras3}: Excellent - direct access to pretrained models (ResNet, EfficientNet, BERT){torch}: Good - torchvision models, easy fine-tuning{tidymodels}: Integrates with pretrained embeddingsExpected gain: 10-30% accuracy improvement over training from scratch.
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:
When NOT to use:
Common techniques:
R ecosystem support:
{torch}Expected benefit: 2-3× sample efficiency on new tasks after meta-training.
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
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.
| 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:
torch/keras3 + custom layers{reticulate} or switch languagesScenario: Classify 50 frog species from 3-hour recordings. Have 10 labeled clips per species, 500 hours unlabeled.
Solution:
R implementation path:
{tuneR} + {torch} for audio preprocessing{luz}Reference: See SSL+FSL combination pattern in examples/ssl-fsl-combination-pattern.md
Scenario: Detect rare disease from X-rays. 50 positive cases, 1000 negative cases, 100k unlabeled X-rays.
Solution:
R implementation path:
{keras3}: Load pretrained DenseNet/EfficientNet{themis} for imbalance handling in {tidymodels}Scenario: Sentiment classification with 5 annotators per text. 30% annotator disagreement.
Solution:
R implementation path:
{text} package for BERT embeddings{tidymodels} for classifier training{keras3}, {torch})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)
{torch}, {luz}, {keras3}{keras3}, {torch}, {tidymodels}{milr} (basic), custom {torch} implementationsI 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
Invoke this skill when:
This skill does NOT:
r-tidymodels or r-performance)r-datascience, r-tidymodels)npx claudepluginhub sciviews/r-claude-skillsGuides completion of development work by verifying tests, detecting environment, and presenting structured options for merge, PR, or cleanup.
Enforces test-driven development: write failing test first, then minimal code to pass. Use when implementing features or bugfixes.
Guides creation and editing of skills using test-driven development with pressure scenarios and subagents to verify agent compliance.