Nishaglobal Education logo

How machines learn: data, training and models

What training data is, how a model improves by correcting its mistakes, the three main types of learning, and why good data matters more than clever algorithms.

Lesson 2 of 3814 min readQuiz: 5 questions

๐ŸŽฏ By the end of this lesson you will be able to:

  • Describe the training loop in plain words
  • Explain supervised, unsupervised and reinforcement learning with an example of each
  • Understand overfitting and why we test on data the model has never seen
In this lesson
  1. Learning from examples
  2. Data: the fuel
  3. The three main ways machines learn
  4. Overfitting: memorising instead of learning
  5. Training versus using a model
  6. What this means for your role
  7. Key takeaways
  8. Quiz

Learning from examples

Think about how a child learns to recognise dogs. Nobody gives them a rulebook. They see many dogs, someone says "dog", they guess wrong sometimes ("that's a cat"), and they adjust. After enough examples they recognise dogs they have never seen before.

Machine learning works in a similar way. A model starts out knowing nothing useful. It sees an example, makes a guess, compares the guess with the right answer, and adjusts its internal settings slightly to be less wrong next time. Repeat this millions of times and the model becomes good at the task.

1. Exampleinput + right answer2. Predictmodel makes a guess3. Measure errorhow wrong was it?4. Adjustnudge parametersRepeat millions of times
The training loop: predict, measure the error, adjust, repeat. Training stops when the model is good enough on data it has not seen.

Data: the fuel

A model can only learn what is in its data. If the examples are wrong, missing or one-sided, the model will be too. This is why experienced teams say that better data usually beats a cleverer algorithm.

Data problemWhat happensExample
Too few examplesThe model guesses poorlyA support bot trained on 50 tickets
Wrong labelsThe model learns the wrong lessonAngry emails labelled "happy"
Unbalanced dataThe model ignores rare casesFraud is 0.1% of transactions, so "never fraud" looks 99.9% accurate
Biased historyThe model repeats past unfairnessHiring data that reflects past discrimination
Out of dateThe model misses new patternsCustomer behaviour after a big product change

The three main ways machines learn

  • Supervised learning: learning from examples that come with the right answer (labels). Predict house prices from past sales, or classify emails as spam or not. This is the most common type in business.
  • Unsupervised learning: finding structure in data with no labels. Group customers into segments with similar behaviour, or flag transactions that look unusual.
  • Reinforcement learning: learning by trial and error with rewards. A system tries actions, gets a reward or penalty, and learns which actions lead to better results over time. It is used in games and robotics, and to fine-tune language models using human feedback.

Same business, three types of learning

An online shop wants to use its data.

Supervised: predict whether an order will be returned, using past orders labelled returned or kept. Unsupervised: discover groups of customers with similar shopping habits. Reinforcement: learn which order to show product recommendations in, based on what people click.

Overfitting: memorising instead of learning

A student who memorises last year's exam answers will do perfectly on last year's paper and badly on a new one. Models can do the same thing: they become so tuned to their training examples that they fail on new data. This is called overfitting.

To catch it, teams split their data. The model learns from the training set, settings are tuned on a validation set, and the final check uses a test set the model has never seen. Only the test result tells you how the model is likely to perform in the real world.

Training versus using a model

Training happens once, or every so often, and is expensive. Using the trained model to answer a question is called inference and happens every time someone uses the feature. Most teams today do not train large models themselves; they use models trained by companies such as OpenAI, Anthropic or Google, and focus on applying them well. That is exactly what the rest of this course teaches.

What this means for your role

Developer

Expect to spend more time on data pipelines and evaluation than on model code. Keep training, validation and test data separate, and never let test data leak into training.

Tester / QA

Test data is your territory. Build test sets that include rare and difficult cases, and report results per category, not only one overall accuracy number.

Business Analyst / PO

When someone proposes an ML feature, ask early: what data do we have, who labels it, how good is it, and does it represent all our users fairly?

Tech Lead / Architect

Choose the simplest approach that meets the need. Many problems are solved with an existing model plus good data, without training anything new.

Project / Delivery Manager

Data collection and labelling are real work with real cost and time. Include them in plans and estimates, along with time to evaluate results.

Scrum Master / Agile

Model work is experimental. Make learning visible: track experiments, what was tried and what changed, just like any other piece of work on the board.

Try it: spot the data problem

  1. Pick a decision your organisation makes repeatedly, such as approving a request or prioritising a ticket.
  2. Imagine training a model on the last two years of those decisions.
  3. List two ways the historical data could be wrong, incomplete or unfair, and how you would check for each.

Key takeaways

  • Models learn by repeatedly predicting, measuring their error and adjusting their parameters.
  • Data quality matters more than algorithm choice: models learn what is in the data, including its mistakes and biases.
  • Supervised learning uses labelled examples, unsupervised finds structure, reinforcement learns from rewards.
  • Always judge a model on test data it has never seen, and look beyond a single accuracy number.

Key terms

Training data
The examples a model learns from.
Label
The correct answer attached to a training example.
Overfitting
When a model memorises its training data and performs poorly on new data.
Inference
Using a trained model to produce an output for a new input.

Check your understanding

Answer all 5 questions. Score 3 or more to complete the lesson.

  1. 1. What happens in each step of the training loop?

  2. 2. Grouping customers by similar behaviour without any labels is an example of:

  3. 3. A model scores 99% on its training data but 60% on new data. What is the likely problem?

  4. 4. Why can 99.9% accuracy be misleading for a fraud model?

  5. 5. What is inference?

Answer all 5 questions to check.

Practise more