Core Intuition: Four Ways a Learner Receives Feedback
Think about how four different students prepare for an unfamiliar subject. One studies flashcards with exact answers printed on the back (Supervised). Another sorts a box of unlabelled mineral samples by weight and luster (Unsupervised).
A third checks a few labeled samples from an instructor, then groups hundreds of unlabeled rocks by similarity (Semi-Supervised). A fourth learns to ride a bicycle by steering, wobbling, and adjusting balance from immediate physical feedback (Reinforcement).
The Problem It Solves: Matching Data Reality to Algorithms
Real-world datasets rarely arrive neatly packaged with clean target columns. Medical image archives often contain 100,000 raw scans and only 500 radiologist diagnoses. Robotics simulations generate action trajectories without pre-labeled "optimal move" answers.
Forcing every problem into a single paradigm wastes available signals or stalls when labels are missing. Choosing the right learning family matches the algorithm directly to the feedback your environment actually supplies.
Step-by-Step Mechanism: Feedback Loops Across Paradigms
Each paradigm executes a distinct update cycle based on its feedback structure:
1. Supervised: Receive pairs , predict , and minimize prediction loss .
2. Unsupervised: Receive raw vectors only, and optimize structural objectives like cluster compactness or reconstruction error.
3. Semi-Supervised: Train on a small labeled subset, assign confident pseudo-labels or smooth manifold constraints across abundant unlabeled points, and iterate.
4. Reinforcement: Observe state , execute action , collect scalar reward , and update policy to maximize cumulative future return.
Interactive Sandbox: Paradigm Signal Explorer
Switch between the four learning paradigms to inspect how data inputs, feedback signals, and parameter updates differ on the same visual canvas.
Observe how Supervised updates pull toward target labels, Unsupervised shifts prototypes toward unlabeled density centers, Semi-Supervised propagates labels across neighbors, and Reinforcement updates action probabilities from delayed rewards.
Every training sample carries an explicit ground-truth label guiding the dividing boundary.
Mathematical Formulation: Four Objective Functions
Mathematically, semi-supervised learning bridges supervised and unsupervised objectives by adding a consistency term weighted by over unlabeled points . Reinforcement learning swaps static dataset sums for expected discounted return over sequential trajectories.
Key Assumptions: Smoothness, Clusters & Markov States
Each paradigm relies on structural assumptions about the world:
1. Supervised Assumption: Labels accurately measure the target concept with manageable label noise.
2. Semi-Supervised Smoothness: Nearby points in high-density regions share the same label; decision boundaries pass through low-density gaps.
3. Reinforcement Markov Property: The current state summarizes all past history needed to choose optimal action and predict reward .
Common Pitfalls: Confirmation Bias & Reward Hacking
In semi-supervised self-training, early confident mistakes get reinforced as permanent pseudo-labels, creating runaway confirmation bias. Setting too low a confidence threshold contaminates the training pool.
In reinforcement learning, poorly designed rewards trigger reward hacking: an agent maximizes the proxy score without solving the intended task (for example, spinning in circles to collect checkpoint points).
You have 200 labeled customer support tickets and 50,000 unlabeled tickets, plus no reward loop. Which paradigm fits best?
Computational Complexity: Annotation vs. Sample Efficiency
Supervised learning offers high sample efficiency ( training per pass) but requires human annotation cost. Unsupervised learning removes labeling cost entirely, though structure discovery like pairwise similarity scales unless approximated.
Reinforcement learning typically exhibits the highest sample complexity, often requiring millions of simulated environment rollouts ( for episodes of length ) because each trajectory reveals only sparse scalar rewards.
Real-World Use: Modern Self-Supervised Pretraining
Large language and vision systems blend these paradigms in stages. First, self-supervised pretraining (an unsupervised variant that creates masked-word targets directly from raw text) learns rich representations across billions of unlabeled documents.
Next, supervised fine-tuning adapts the model to curated question-answer pairs. Finally, reinforcement learning aligns outputs using human preference rewards.
Production Code: Semi-Supervised Label Propagation
Compare a NumPy nearest-neighbor pseudo-label step with scikit-learn SelfTrainingClassifier on partially labeled observations.
import numpy as np
# 2 labeled points and 4 unlabeled points (-1 marks unlabeled)
X = np.array([[0.0, 0.1], [0.2, 0.0], [0.1, 0.2], [5.0, 5.1], [5.2, 4.9], [4.9, 5.0]])
y = np.array([0, -1, -1, 1, -1, -1])
labeled_mask = y != -1
X_labeled, y_labeled = X[labeled_mask], y[labeled_mask]
X_unlabeled = X[~labeled_mask]
# Propagate label from closest labeled sample in Euclidean space
dists = np.linalg.norm(X_unlabeled[:, None, :] - X_labeled[None, :, :], axis=2)
pseudo_labels = y_labeled[np.argmin(dists, axis=1)]
y_filled = y.copy()
y_filled[~labeled_mask] = pseudo_labels
print("Propagated labels:", y_filled)In the NumPy implementation, broadcasting computes pairwise distances from every unlabeled point to the labeled anchors and propagates labels across local neighborhoods. In scikit-learn, SelfTrainingClassifier wraps any probabilistic base estimator, iteratively adding unlabeled points whose predicted probability exceeds threshold=0.75.
threshold >= 0.75) when pseudo-labeling unlabeled points to prevent error amplification.