No history yet

Learning Paradigms and Trade-offs

Choosing the Right Learning Paradigm

Moving beyond basic definitions, selecting the right machine learning paradigm requires understanding the mechanics of how models learn and the trade-offs involved. It's less about what a model is and more about what it's trying to achieve and how it gets there. At the heart of this process is the objective function.

Objective Function

noun

A mathematical function that a machine learning model aims to minimise or maximise. In most cases, it quantifies the difference between a model's predictions and the actual ground truth, often called the loss or cost function.

Think of the objective function as defining a landscape, often called the loss surface. This surface has peaks and valleys, where the lowest point represents the best possible model performance (the minimum loss). The model's parameters, like weights and biases, are the coordinates on this landscape. The learning process is a journey to find the lowest valley.

Navigating the Loss Surface

How does a model find that lowest point? It uses an optimisation algorithm. The most common is Gradient Descent. It calculates the slope (gradient) of the loss surface at the model's current position and takes a step downhill. Doing this for the entire dataset at once is computationally expensive. This is where Stochastic Gradient Descent (SGD) and its variants come in.

SGD calculates the gradient using just a single random data point (or a small 'mini-batch') at each step. It's a noisier, more zig-zagging path down the mountain, but it's much faster and can even help the model escape shallow valleys that aren't the true minimum. Variants like Adam or RMSprop are more sophisticated, adapting the step size for each parameter to navigate the surface more intelligently.

θt+1=θtηJ(θt;x(i),y(i))\theta_{t+1} = \theta_t - \eta \nabla J(\theta_t; x^{(i)}, y^{(i)})

The Bias-Variance Trade-off

As your model learns, it's walking a tightrope. On one side is bias, and on the other is variance. A model with high bias is too simple; it makes strong assumptions about the data and fails to capture its underlying patterns (underfitting). A model with high variance is too complex; it fits the training data's noise instead of its signal (overfitting). It performs brilliantly on data it has seen but fails on new, unseen data.

The is the central challenge in model selection. A simple model will have high bias and low variance, while a highly complex model will have low bias and high variance. The goal is to find a sweet spot, a model complex enough to capture the signal but not so complex that it models the noise. This is managed through techniques like regularisation, cross-validation, and carefully selecting model architecture.

A model's performance on unseen data is the ultimate test. High accuracy on the training set means very little if the model can't generalise.

Beyond simple accuracy, choosing the right evaluation metric is crucial. For a medical diagnosis model, a false negative (saying a patient is healthy when they are not) is far more dangerous than a false positive. In this case, metrics like recall or F1-score, which account for this imbalance, are more appropriate than simple accuracy.

From Rules to Rewards

Early AI, or , was based on logic and rules hand-crafted by experts. Think of a chess program where a developer explicitly codes rules like "a bishop is worth 3 points" or "control the centre of the board". This approach is transparent and works well in constrained environments but is brittle. It can't handle uncertainty or learn from new data.

Modern, data-driven approaches are probabilistic. They learn patterns and relationships directly from data. This is the foundation of supervised and unsupervised learning. But what if you don't have a labelled dataset, and the 'right' answer depends on a sequence of actions?

This is where reinforcement learning (RL) shines. An RL agent learns by interacting with an environment. It takes actions, receives rewards or penalties, and adjusts its strategy to maximise its cumulative reward over time. The core challenge here is the exploration vs. exploitation trade-off. Should the agent 'exploit' the strategy it knows works best so far, or 'explore' new, untried actions that might lead to an even bigger reward? A self-driving car must mostly exploit known safe driving techniques, but it also needs to explore new situations to learn and improve.

A fundamental dilemma in RL is the exploration vs. exploitation tradeoff.

Choosing the right paradigm depends on your problem. Do you have a large, labelled dataset to learn from? Supervised learning is your best bet. Do you have unlabelled data and want to find hidden structures? Unsupervised learning is the way to go. Do you need an agent to learn a sequence of actions in a dynamic environment to achieve a goal? That's a job for reinforcement learning.

Time to test your understanding of these core concepts.

Quiz Questions 1/6

What does the 'loss surface' in machine learning metaphorically represent?

Quiz Questions 2/6

A machine learning model performs exceptionally well on the data it was trained on but fails to generalise to new, unseen data. This model likely has...

Understanding these mechanics allows you to make informed decisions, moving from simply applying models to architecting intelligent systems.