Chapter 3 Machine Learning Models and Selection
Synopsis
Types of Machine Learning Approaches
Machine learning models can be broadly categorized into supervised, unsupervised, and reinforcement learning. Supervised learning uses labelled data to predict outcomes, such as classification and regression tasks. Unsupervised learning identifies patterns in unlabelled data, such as clustering. Reinforcement learning focuses on decision-making through trial and error, often used in dynamic environments. Understanding these approaches helps developers choose the right strategy for a given problem.
Machine learning techniques are commonly grouped into three main approaches based on how the model learns from data: supervised learning, unsupervised learning, and reinforcement learning. Each approach is suited to different kinds of problems and data availability.
Supervised learning involves training a model using a dataset in which both the inputs and the correct outputs are already known. The algorithm learns the relationship between input features and target labels so it can make predictions on new, unseen data. This approach is widely used for tasks such as identifying whether an email is spam, predicting house prices, recognizing images, or diagnosing diseases from medical scans. Because the model learns from examples with known answers, its performance can be measured directly using accuracy or error metrics.
Unsupervised learning, in contrast, works with data that does not contain predefined labels. Instead of predicting known outcomes, the algorithm explores the structure of the data to uncover hidden patterns, similarities, or groupings. For example, it can segment customers into distinct groups based on purchasing behaviour, detect anomalies in financial transactions, or reduce data dimensions for visualization. This approach is especially valuable when labelling data is expensive, difficult, or impossible.
Reinforcement learning focuses on learning through interaction with an environment rather than from a fixed dataset. In this approach, an agent takes actions and receives feedback in the form of rewards or penalties. Over time, the agent learns which actions lead to the best long-term outcomes. Reinforcement learning is commonly applied in situations that involve sequential decision-making, such as robotics, autonomous driving, game playing, resource management, and recommendation systems that adapt over time.
Understanding the differences among these approaches enables developers and researchers to select the most appropriate method for their specific problem. The choice depends on factors such as the availability of labelled data, the nature of the task, and whether the system must learn from static information or ongoing interaction.
1. Supervised Learning - Email Spam Detection
Supervised learning is based on training a model using examples that already include the correct outputs. In this method, the algorithm learns a mapping between inputs and known targets, enabling it to make predictions for new, unseen data. Email spam detection is a classic illustration of this approach. Developers compile a large collection of messages that have been manually categorized as either unwanted or legitimate. By examining characteristics such as frequently occurring words, suspicious links, sender reputation, message structure, and unusual formatting, the model learns patterns associated with spam.
Once trained, the system can automatically evaluate incoming emails and assign them to the appropriate folder. Over time, many systems continue to improve by incorporating user feedback, such as marking messages as spam or safe. Beyond email filtering, supervised learning is widely applied in domains where historical labelled data is available. Examples include diagnosing diseases from medical images, assessing credit risk in banking, forecasting sales, and converting spoken language into text. Its effectiveness stems from the availability of clear examples that guide the learning process.
2. Unsupervised Learning - Customer Segmentation
Unsupervised learning operates without predefined labels or categories. Instead of predicting known outcomes, the algorithm explores the data to uncover underlying patterns, structures, or groupings. Customer segmentation in retail or e-commerce is a typical application. Companies accumulate extensive transaction records containing details such as purchase frequency, spending amounts, product preferences, and browsing behaviour, but they may not know in advance how customers should be categorized.
An unsupervised algorithm analyses similarities among customers and organizes them into clusters with shared characteristics. For instance, one group might consist of frequent low-cost shoppers, another of high-value premium buyers, and another of occasional seasonal purchasers. These insights enable businesses to tailor marketing strategies, personalize recommendations, adjust pricing policies, and manage inventory more efficiently. Unsupervised learning is also used in anomaly detection, document organization, gene expression analysis, and exploratory data analysis, making it valuable when the goal is discovery rather than prediction.
3. Reinforcement Learning - Autonomous Game Playing
Reinforcement learning takes a fundamentally different approach by focusing on learning through interaction with an environment. Instead of relying on labelled examples, an agent learns by performing actions, observing the outcomes, and receiving feedback in the form of rewards or penalties. Over repeated trials, the agent develops strategies that maximize cumulative rewards over time. Training artificial intelligence to play video games or strategic board games is a well-known example. The system experiments with various moves, gradually identifying which actions lead to success and which lead to failure.
This trial-and-error process enables the agent to discover complex strategies that may not be explicitly programmed. Reinforcement learning has expanded beyond games into practical applications such as robotic control, autonomous vehicles, dynamic pricing, traffic management, energy optimization, and adaptive recommendation systems. In these settings, the ability to learn from experience and adjust behaviour in changing conditions is crucial.
Comparative Perspective
Each learning paradigm addresses a distinct category of problems. Supervised learning excels when reliable labelled data is available and the goal is accurate prediction. Unsupervised learning is suited for uncovering hidden structures in data where categories are unknown. Reinforcement learning focuses on sequential decision-making in dynamic environments where outcomes depend on actions over time. Together, these approaches form the foundation of modern machine learning, enabling intelligent systems to predict outcomes, reveal insights, and adapt through experience across a wide range of applications.
