← CodeClarityLab Home
Browse by Category
+ added · updated 7d
← Back to glossary

ML Types

ai_ml Intermediate

Also Known As

supervised learning unsupervised learning reinforcement learning ML paradigms

TL;DR

Supervised (labelled examples), unsupervised (find patterns), reinforcement learning (reward signals), and self-supervised (model creates its own labels).

Explanation

Supervised: labelled input→output pairs. Classification (spam/not), regression (predict price). Unsupervised: clustering (K-means), dimensionality reduction, anomaly detection. Self-supervised: model generates its own labels from data — GPT predicts next token. Reinforcement learning: agent+rewards+policy — game playing, RLHF for fine-tuning LLMs. Choosing the right paradigm depends on: whether labels are available, whether you need groups or predictions, and latency requirements.

Common Misconception

LLMs are trained purely with supervised learning — modern LLMs use self-supervised pre-training (predict next token) then RLHF (reinforcement learning from human feedback).

Why It Matters

Choosing the wrong ML paradigm wastes engineering effort — labelled churn data should use supervised classification, not unsupervised clustering which cannot use the labels.

Common Mistakes

  • Supervised learning without sufficient labelled data — model learns noise
  • Using clustering when supervised labels are available — worse results
  • Ignoring class imbalance in supervised classification
  • Not considering self-supervised approaches when labelling is expensive

Code Examples

✗ Vulnerable
// Goal: detect fraud (labelled historical data exists)
// Wrong choice: unsupervised clustering (ignores labels)
// Should use: supervised binary classification with fraud labels
✓ Fixed
// Matching ML type to problem:
// Churn prediction (labelled) → supervised: logistic regression
// Customer segments (no predefined groups) → unsupervised: K-means
// Optimise recommendations (engagement signal) → reinforcement: bandit
// PHP code completion (large PHP codebase) → self-supervised: next-token

Tags

ai ml

Added 16 Mar 2026
Edited 22 Mar 2026
Views 30
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings F 0 pings S 0 pings S 1 ping M 0 pings T 0 pings W 0 pings T 0 pings F 1 ping S 0 pings S 0 pings M 0 pings T 0 pings W 2 pings T 0 pings F 2 pings S 0 pings S 0 pings M 0 pings T 1 ping W 0 pings T 1 ping F 1 ping S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 1 ping S
No pings yesterday
Amazonbot 9 Perplexity 5 Unknown AI 3 ChatGPT 3 Ahrefs 2 Majestic 1 Google 1
crawler 22 crawler_json 1 pre-tracking 1
DEV INTEL Tools & Severity
🔵 Info ⚙ Fix effort: Low
⚡ Quick Fix
For PHP developers integrating AI: supervised learning (classification, prediction from labelled data) is what most ML APIs provide; you consume the model output via API, not train the model yourself
📦 Applies To
any web cli
🔗 Prerequisites
🔍 Detection Hints
Building a custom ML model when a pre-trained API (OpenAI, Claude) would suffice; misunderstanding supervised vs unsupervised for use case selection
Auto-detectable: ✗ No
⚠ Related Problems
🤖 AI Agent
Confidence: Low False Positives: High ✗ Manual fix Fix: High Context: File

✓ schema.org compliant