Aller au contenu
Londres, Royaume-Uni · Fondé en 1994
Français

Unit 1: Foundations of Machine Learning

What machine learning is, how it differs from traditional programming, the main types of learning, the stages of a machine-learning project and the vocabulary used to describe data and models.

Unit 1 of 5 · about 54 minutes

1.1 What machine learning is and when to use it

Machine learning (ML) is a branch of artificial intelligence in which computer systems learn patterns from data rather than following rules written out by hand. Instead of a programmer specifying exactly how to decide whether an email is spam, a machine-learning system is shown many examples of emails labelled as spam or not spam and works out for itself which patterns tend to distinguish them. The result, called a model, can then be applied to new emails it has never seen.

Traditional programming compared with machine learning

In traditional programming, people provide rules and data, and the computer produces answers. In machine learning, people provide data and examples of the answers, and the computer produces the rules, in the form of a model. This is powerful when the rules are too complex, too numerous or too changeable to write by hand. Few people could write precise rules for recognising a handwritten number or predicting which customers are likely to cancel a subscription, but given enough examples, a model can learn useful patterns for both.

The main types of machine learning

  • Supervised learning: the model learns from examples where the correct answer, called the label, is known. Predicting house prices from past sales, or classifying loan applications as likely to default or not, are supervised tasks. Most business applications fall into this category.
  • Unsupervised learning: the data has no labels, and the aim is to discover structure, such as groups of similar customers or unusual transactions.
  • Reinforcement learning: an agent learns by trial and error, receiving rewards or penalties for its actions. It has been used in game playing, robotics and some control systems, and in refining the behaviour of large language models.

Two related terms are worth knowing. Self-supervised learning creates its own labels from the data, for example by hiding a word in a sentence and learning to predict it; this is how large language models are mainly trained. Deep learning refers to machine learning with many-layered neural networks, covered later in this course.

Common applications

Machine learning is used across many sectors: forecasting demand in retail, detecting fraud in payments, recommending products and content, routing customer enquiries, predicting equipment failures in manufacturing, scoring credit risk, supporting medical image analysis, and translating and summarising text. In most of these cases the model supports human decisions or automates a narrow, well-defined task.

When machine learning is a good fit

Machine learning is most likely to help when:

  1. There is a clear, specific question to answer or decision to support.
  2. Patterns exist in data but are too complex to capture with simple rules.
  3. Enough relevant, good-quality historical data is available, including labels for supervised learning.
  4. The decision is repeated often enough for automation or support to be worthwhile.
  5. Occasional errors are acceptable, or can be caught by human review.

It is a poor fit when a simple rule would work just as well, when data is scarce or unreliable, when every decision must be fully explainable and the model cannot provide that, or when errors would be severe and cannot be detected.

Tip: Before starting a machine-learning project, ask what the simplest possible approach would achieve, such as a rule of thumb or a basic average. This "baseline" shows whether machine learning adds enough value to justify its cost and complexity.

Prediction is not causation

Most machine-learning models find correlations: patterns that tend to occur together. They do not, on their own, establish causes. A model may learn that customers who contact support frequently are more likely to cancel, but that does not mean reducing contact would keep them; both may be caused by an underlying product problem. Confusing prediction with causation is a common and costly mistake when acting on model outputs.

Common misunderstandings

  • "The model understands the problem." It has learned statistical patterns from data, which may or may not reflect real understanding.
  • "More data always fixes everything." More poor or biased data can make things worse.
  • "Once built, a model works forever." The world changes, and model performance usually degrades without monitoring and retraining.

In practice

When someone proposes using machine learning, ask four questions: What decision will the model support? What data will it learn from, and is it representative of the cases it will face? How will we measure whether it is better than what we do now? What happens when it is wrong? Clear answers are a strong sign that a project is well conceived.

1.2 The machine-learning project lifecycle

Building a useful model involves much more than choosing an algorithm. Successful projects follow a structured lifecycle, and in practice most of the effort goes into understanding the problem and preparing data rather than into modelling itself. A widely used framework, the Cross-Industry Standard Process for Data Mining (CRISP-DM), describes six phases that remain a useful guide for machine-learning work.

1. Business understanding

Every project should start with a clearly defined objective expressed in business terms, such as reducing late deliveries or prioritising fraud investigations. The team then translates this into a machine-learning task: what exactly will be predicted, for which cases, at what point in time, and how will predictions be used? They also agree how success will be measured, both in model terms and in business terms, and identify constraints such as privacy, fairness, explainability and budget.

2. Data understanding

Next, the team finds out what data exists, where it comes from, how it was collected, what each field means and how reliable it is. They explore the data with summaries and charts, looking for missing values, errors, unusual distributions and potential biases. Crucially, they check whether the data available at training time will also be available, in the same form, when the model is used.

3. Data preparation

Raw data is rarely ready for modelling. Preparation includes cleaning errors, handling missing values, combining sources, creating useful input variables and splitting the data into sets for training and testing. This phase commonly takes the largest share of project time.

4. Modelling

The team trains one or more candidate models, starting with simple approaches and a baseline. They adjust settings, compare results and select promising candidates. Modern tools make training models relatively quick; the challenge lies in doing it rigorously.

5. Evaluation

Models are tested on data they have not seen during training, using measures that reflect the real goal. The team also checks for problems such as unfair performance across groups, reliance on suspicious inputs and behaviour in unusual cases. Evaluation asks not only "is the model accurate?" but "does it meet the business objective, and is it safe to use?"

6. Deployment

Finally, the model is integrated into real processes and systems, monitored and maintained. Deployment may be as simple as a weekly report or as complex as real-time predictions inside a customer-facing application. In modern practice, a seventh activity is emphasised: monitoring and maintenance, because models degrade as conditions change.

Remember: The lifecycle is iterative, not a straight line. Evaluation often sends teams back to collect more data, rethink features or even redefine the problem.

Roles in a machine-learning project

RoleTypical contribution
Business owner or sponsorDefines the problem, success measures and how predictions will be used
Domain expertsExplain the data and process, spot implausible results and judge usefulness
Data engineersBuild reliable pipelines to collect, clean and deliver data
Data scientists or ML engineersPrepare features, train and evaluate models and support deployment
Risk, legal and data protection staffAdvise on privacy, fairness, regulation and governance

Projects that involve domain experts closely tend to produce more useful and trustworthy results. Many failures stem not from technical mistakes but from models that answer the wrong question or cannot be fitted into how people actually work.

Common reasons projects fail

  • A vague objective, such as "use AI on our customer data", with no defined decision to support.
  • Insufficient or poor-quality data, discovered late.
  • Impressive results in testing that rely on information not available in real use.
  • No plan for integrating predictions into processes, so the model is never used.
  • No owner for monitoring after launch, so performance quietly declines.

In practice

If you are asked to sponsor or contribute to a machine-learning project, request a one-page project definition covering the business objective, the prediction, the data sources, the success measures, the baseline to beat, the people involved and how predictions will be acted upon. Reviewing this page together at the start avoids many expensive misunderstandings later.

1.3 Data, features, labels and splitting

Machine learning has its own vocabulary for describing data. Learning these terms makes technical discussions much easier to follow and helps you ask the right questions about any model.

Examples, features and labels

Machine-learning data is usually arranged as a table. Each row is an example (also called an instance, observation or record), such as one customer, one transaction or one house sale. Each column describes something about the example:

  • Features (also called inputs, predictors or variables) are the pieces of information the model uses to make its prediction, such as a house's floor area, number of bedrooms, location and age.
  • The label (also called the target or outcome) is what we want to predict, such as the sale price. Only supervised learning uses labels.

Features come in different types. Numerical features are quantities, such as income or temperature. Categorical features are categories, such as product type or region. Some features are text, images or dates, which usually need converting into numbers before most models can use them.

Regression and classification

Supervised tasks fall into two broad families depending on the label:

  • Regression predicts a number, such as a price, a delivery time or next month's sales.
  • Classification predicts a category, such as fraud or not fraud, or which of several departments should handle an enquiry. Many classification models also give a probability for each category.

Where labels come from

Labels may come from historical outcomes recorded in business systems, such as whether a loan was repaid, or from people labelling data specifically for the project, such as tagging customer emails by topic. Label quality matters enormously. If labels are inconsistent, out of date or reflect biased past decisions, the model will learn those flaws. Checking a sample of labels with domain experts is one of the most valuable steps in any project.

Training, validation and test sets

To know whether a model will work on new data, we must test it on data it has not seen during training. Data is therefore usually split into three parts:

  1. The training set, used to fit the model. This is typically the largest share.
  2. The validation set, used to compare models and adjust settings during development.
  3. The test set, kept aside until the end and used once to estimate how the final model will perform in real use.

A common rough split might be around 70 per cent for training and 15 per cent each for validation and testing, though proportions vary with the amount of data available. A technique called cross-validation, covered later, makes better use of smaller datasets.

Tip: Treat the test set like a sealed exam paper. If you repeatedly check results against it and adjust the model, it stops being a fair test and your performance estimate will be too optimistic.

Splitting sensibly

How you split matters as much as whether you split. If the model will predict the future, split by time: train on older data and test on more recent data, because random splitting lets the model "see the future". If the same customer or patient appears in many rows, keep all their rows in the same set, or the model may simply recognise individuals rather than learning general patterns. When one category is rare, such as fraudulent transactions, make sure each set contains a representative share of it.

How much data is enough?

There is no universal answer. Simple models with a few strong features may work with hundreds of examples; complex models for images or language may need many thousands or millions. What matters most is that the data is relevant and representative of the situations in which the model will be used, including less common cases. A large dataset that excludes an important group of customers can perform worse for that group than a smaller, more balanced one.

Data protection

Training data often contains personal information. Where data protection laws such as the GDPR apply, organisations need a lawful basis for using personal data, should use only what is necessary, and must consider transparency, security and individuals' rights. Removing obvious identifiers such as names does not always make data anonymous, because combinations of features can still identify people.

In practice

For any model you encounter, ask: What are the features and the label? Where did the labels come from, and how reliable are they? How was the data split, and was the test set kept separate until the end? Does the data represent the people or situations the model will be used on? These four questions reveal many weaknesses quickly.

Case study: Defining a churn prediction project at a gym chain

Pulse Fitness, a fictional chain of fifteen gyms, wanted to reduce the number of members cancelling their memberships. The marketing director initially asked the data team to "use machine learning on our member data". The lead data analyst suggested first writing a one-page project definition.

Together they agreed a specific prediction: which current members were likely to cancel within the next sixty days, produced weekly so that club managers could offer a personal check-in. Features would include visit frequency, recent changes in attendance, membership type, class bookings and length of membership. The label would be whether each member had cancelled within sixty days, taken from historical records.

The analyst insisted on splitting the data by time, training on records from earlier years and testing on the most recent months. A simple baseline, flagging anyone who had not visited for three weeks, was measured first. The final model identified noticeably more at-risk members than the baseline, and club managers reviewed every flagged member before contacting them.

Activity

Think of a repeated decision or prediction in your work that machine learning might support. Describe the prediction, state whether it is regression or classification, and list at least five possible features and the label. Then explain how you would split the data for testing and one reason why machine learning might not be the right approach.

Compare with a model answer

A good answer defines a specific prediction, for example estimating how many days a customer support ticket will take to resolve, which is a regression task. It lists sensible features available when the ticket is created, such as product, channel, customer tier, ticket category and the current queue length, and names the label as the actual resolution time from past tickets.

It proposes splitting by time, training on older tickets and testing on recent ones, because the model will be used to predict future tickets. It notes a realistic reason for caution, such as resolution times being heavily affected by staffing changes not captured in the data, or a simple average by category already being good enough. The best answers avoid features only known after resolution.

Key takeaways

  • Machine learning produces models by learning patterns from data and examples, rather than from hand-written rules.
  • Supervised learning uses labelled examples, unsupervised learning finds structure in unlabelled data and reinforcement learning learns from rewards.
  • Successful projects follow an iterative lifecycle, from business understanding and data preparation to evaluation, deployment and monitoring.
  • Data is described in terms of examples, features and labels; regression predicts numbers and classification predicts categories.
  • Models must be tested on data kept separate from training, split in a way that reflects how the model will be used.

Unit check

Create a free account to answer the check, save your progress and receive your free certificate.

Create a free account Log in
← Course overview Unit 2 →
WhatsApp