Learning paradigms
Machine learning (ML) uses examples or experience to construct a model or policy rather than requiring a programmer to specify every prediction or action. The model is an artifact that can be applied to new inputs. A learning objective specifies what should improve; the source of the learning signal helps distinguish the paradigms. Start with the task and the available evidence, not the most fashionable algorithm.
Supervised learning: learn from known outcomes
A shipment record might contain a route, weight and a label saying whether the delivery was late. The route and weight are features (inputs); the known outcome is the target or label. Predicting late versus on time is classification; predicting the number of minutes late is regression. Training uses known outcomes; inference receives only features available at the intended prediction time. A label recorded after delivery is a valid target, but including it in the input before delivery would be leakage.
def fit_delay_by_route(records): # Records contain a route and a known delay label: 0 or 1. groups = {} for route, label in records: groups.setdefault(route, []).append(label) return {route: int(2 * sum(labels) > len(labels)) for route, labels in groups.items()}
def predict_delay(model, route): return model.get(route) # None means no learned route rule.
model = fit_delay_by_route([('north', 1), ('north', 1), ('north', 0), ('south', 0)])print(model)print(predict_delay(model, 'north'))print(predict_delay(model, 'west'))Output: {'north': 1, 'south': 0}, then 1, then None on separate lines. The model stores the most common binary label for each observed route, with ties mapped to 0. For north, two of three labels are 1. A previously unseen route returns None to indicate abstention, not a predicted on-time delivery. This is a small supervised learner, not a production delay model. Its objective implicitly minimizes training misclassifications within each route; it does not use other features or estimate reliable probabilities.
Unsupervised learning: find structure without target labels
Suppose the warehouse has shipment weights but no delay labels. Grouping shipments with similar weights could help explore the dataset. Clustering and dimensionality reduction are common unsupervised tasks. The next teaching algorithm sorts one numeric feature and separates it at its largest gap. It learns a boundary from the data rather than using known classes. It is not k-means, and the largest-gap rule is only a simple one-dimensional heuristic.
def gap_groups(values): # Teaching algorithm: split sorted numbers at the first largest gap. ordered = sorted(values) if len(ordered) < 2 or ordered[0] == ordered[-1]: return [ordered] if ordered else [] boundary = max(range(1, len(ordered)), key=lambda i: ordered[i] - ordered[i - 1]) return [ordered[:boundary], ordered[boundary:]]
print(gap_groups([10, 2, 11, 3, 4]))print(gap_groups([5, 5, 5]))Output: [[2, 3, 4], [10, 11]] and [[5, 5, 5]]. The gap between 4 and 10 is 6. Equal values form one group; empty input gives no groups. For tied largest gaps the first is selected. The algorithm makes no claim that the two groups correspond to real shipment categories. Noise, outliers or units can change grouping. An inventory expert should assess whether a group is meaningful.
Self-supervised, semi-supervised and reinforcement learning
Self-supervised learning constructs its training targets from the data itself. For example, hide one word in a shipment description and use the original word as the target. Predicting the next token in text is another example. No separate human label is required for that target, but the model still has an explicit prediction objective. The learned representation (an internal encoding of the input) can later support classification or another task. Semi-supervised learning combines a limited set of labeled examples with additional unlabeled examples for a target task. For instance, use 100 verified damage labels and 2,000 unlabeled descriptions; proposed pseudo-labels are not verified truth and can amplify errors.
Reinforcement learning (RL) learns a policy for selecting actions using experience and rewards. A simulated warehouse cart could receive +5 for reaching a shelf and -1 per move. Its action changes the state, and the goal is to improve expected cumulative reward. A reward is evaluative feedback, not necessarily a label naming the best action. An immediate reward can be misleading if a later action has a larger cost. RL may learn from recorded experience as well as interaction; never assume a live system must be explored. No real cart is controlled here.
Choose the signal, not a buzzword
If a fixed capacity rule answers the business question, start there. If known outcomes exist and predictions are needed, supervised learning is a candidate. If only patterns are needed without labels, try unsupervised exploration. If targets can be derived automatically, consider self-supervision; if few labels and many unlabeled examples support the same task, consider semi-supervision. If sequential decisions and delayed feedback matter, RL may be appropriate, but a known planning model or simple policy can be safer and easier. These categories can overlap in a system; a self-supervised representation may later be fine-tuned with labeled data.
Practice and next step
Classify these tasks: forecast minutes late from historical delivery outcomes; group untagged shipment weights; recover missing text; train a classifier using a mix of verified and unlabeled examples; improve a simulated routing policy from rewards. Explain the learning signal for each. In the next lesson, learn how to compare a fitted prediction with a simple baseline on unseen examples.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Learning paradigms quiz
Apply the learning objectives to new fictional examples.
Which shipment task uses supervised classification?
A dataset has 100 verified damage labels and 2,000 unlabeled records. Which approach specifically combines both for a damage classifier?
What supplies a self-supervised masked-word target?
What does gap_groups([8, 2, 3, 9]) return?
Why does a reward in reinforcement learning differ from a label specifying the best action?