How does a machine learn?
A model learns relationships from examples, like an apprentice seeing many cases.
What you will learn
- Explain: how learning changes a model
- Apply the idea in an example: How does a machine learn?
- Recognize limitations and verify the exercise outcome
A model learns relationships from examples, like an apprentice seeing many cases. Unlike an apprentice, its adjustment is a numeric process.
You can follow this course without an account or programming. Examples use synthetic data and AI outcomes need checking.
How it works, step by step
How learning changes a model
Training data is the set of examples used to adjust model parameters. Supervised learning includes a target, such as “spam”. Unsupervised learning finds structure, such as customer groups. Self-supervised learning creates targets from data, for example predicting following text. Validation helps choose settings; the test set stays separate until final evaluation. A model that memorizes examples and fails on new data is overfitting. A proper split prevents information from the test set leaking into training.
Define success before optimizing
Prepare representative requests and expected answers or properties. Include ordinary cases, ambiguity, missing data and tool errors. For RAG, measure evidence retrieval separately from answer correctness. Recall@k measures the share of relevant evidence found in the first k results; precision@k measures the share of returned results that are relevant. For agents, also track actions, permissions and stopping. An LLM-as-judge can speed evaluation but needs calibration against humans. Do not change prompt, model and index simultaneously if you want to understand what improved results.
AI is not one kind of model
Artificial intelligence is a family of methods for recognition, prediction, planning and generation. A rule-based system follows instructions written by people. Machine learning learns relationships from examples; deep learning uses networks with many layers. Generative AI produces new content. An LLM works with language, but product recommendations or defect detection may use other models. Think of a toolbox: choose a tool for the problem. A simple algorithm can be more suitable than an agent for a fixed rule.
The visual map
Follow the solid arrows for the main flow. Dashed blue arrows supply data or context; dashed pink arrows show feedback or returning results. Colors and shapes distinguish models, stores, decisions and outputs. Training and validation guide model development. The held-out test set is used for final evaluation, never to tune the model. On smaller screens, scroll horizontally to follow the entire diagram.
A complete example
You have 100 messages labeled spam or legitimate. Split before training. Near-duplicates should not span train and test: otherwise evaluation becomes too easy.
Try it yourself
- Design train/validation/test sets and explain how to remove duplicates.
- Record the input, source and expected outcome before running the experiment. Use only the fictional data in the example.
- Follow the diagram stages. At every step record what information is received and produced; do not confuse intermediate output with the final outcome.
- Repeat after removing necessary information or making the input ambiguous. Check whether the system clarifies, stops or invents an answer.
- Compare with the explained solution. Keep the configuration, date, result and an explanation for differences. Change one thing and retest.
An explained solution
Measure performance on unseen examples; false alarms on legitimate messages matter separately from missed spam. A successful exercise lets you show the connection between input, stages and outcome. When information is missing, a cautious answer is more useful than invented details. Compare more than style: check conditions, sources and operations too.
When it helps and what can go wrong
More incorrectly labeled data can amplify errors. Choose this approach when it improves a measured need. Keep a simple baseline and compare outcomes using identical inputs. One successful example does not establish reliability in every situation.
Check your understanding
Why not evaluate only on training data?
We want performance on new situations, not proof of memorization.
Does a good style score prove agent success?
No. The agent may write beautifully after using the wrong tool or data.
What outcome should this exercise produce?
Measure performance on unseen examples; false alarms on legitimate messages matter separately from missed spam.
Words to remember
- Overfitting: The model fits the examples it has seen too closely.
- Regresie / Regression: A change that breaks a previously correct case.
- AI: A family of methods, not a synonym for chatbot.
Sources and your next step
To prepare: F01 — What is artificial intelligence?