You are viewing a public preview
Sign in to save your progress, do assignments, join discussions and get feedback.
After this unit you will: be able to place Machine Learning within the bigger picture of AI and Data Science, and describe how a model improves itself with each training loop.
By the end of this lesson you can:
Key idea: A machine learns the same way a student does: it makes an attempt, compares the attempt with the correct answer, measures how wrong it was with a loss function, and updates itself. Repeating this loop many times is what we call training.
Beginners often hear many related terms and mix them up. The lecture places them inside each other like circles:
| Field | What it covers |
|---|---|
| Computer science | The broad field: programming, algorithms, software engineering, systems, databases, networks |
| Artificial intelligence (AI) | Systems that do tasks that normally need human intelligence: recognising images, understanding language, making decisions |
| Machine learning (ML) | An approach inside AI where we do not write every rule; the computer learns patterns from data and uses them to predict or decide |
| Deep learning (DL) | A smaller area inside ML that uses neural networks with many layers; strong for images, speech, language and very large data |
So deep learning is a subset of machine learning, machine learning is a subset of AI, and AI is a subset of computer science.
Data science is a different kind of field. It is interdisciplinary: it sits at the intersection of computer science, mathematics and statistics, and domain knowledge.
Machine learning can be one part of a data science project, but a data scientist also analyses data, finds insights, writes reports, communicates results and sometimes deploys solutions. Data science overlaps with AI and ML; it is not simply another name for them.
The lecture uses a familiar school example as the foundation for the whole course. You receive an exercise. As a student, you produce a submission. The teacher compares your submission with the solution and gives you a result (a grade or comments). Based on that result you improve and try again. Attempt, compare with the correct answer, get feedback, improve: this is how people learn from experience.
Machine learning follows almost exactly the same loop, only with new names:
| Human learning | Machine learning |
|---|---|
| Exercise | Data (the input) |
| Student | Model (the thing that learns) |
| Submission | Prediction |
| Solution | Ground truth (the true value) |
| Teacher's grading | Loss function |
| Result | Loss value |
| Improve | Update |
The loss function measures how wrong a prediction is compared with the ground truth. A common example is MSE (mean squared error): the average of the squared differences between predictions and true values. The result is a single number, the loss value. A large loss means the model was very wrong; a small loss means it was close. The model then updates its internal settings so that the loss becomes smaller next time.
This loop (data in, prediction out, compare with ground truth, compute loss, update) repeats thousands or even millions of times. The rest of the course fills in the details: what data we use, which models we choose, how we measure loss and how updates happen.
A tiny model predicts y = w * x. The true pattern is y = 2x, but the model starts with w = 0. Each step it predicts, computes the MSE loss and updates w a little in the direction that reduces the loss.
import numpy as np
x = np.array([1.0, 2.0, 3.0]) # data
y = np.array([2.0, 4.0, 6.0]) # ground truth
w = 0.0 # the model's only setting
learning_rate = 0.05
for step in range(1, 6):
prediction = w * x # model makes a prediction
loss = np.mean((prediction - y) ** 2) # loss function: MSE
gradient = np.mean(2 * (prediction - y) * x)
w = w - learning_rate * gradient # update
print(f"step {step}: loss={loss:.3f}, w={w:.3f}")
Expected output:
step 1: loss=18.667, w=0.933
step 2: loss=5.310, w=1.431
step 3: loss=1.510, w=1.697
step 4: loss=0.430, w=1.838
step 5: loss=0.122, w=1.914
The loss shrinks at every step and w moves towards the true value 2. That is the whole training loop in a few lines.
Flashcards · 1.1 How Machines Learn
10 wordsThe part of computer science that builds systems able to do tasks that normally need human intelligence.
An approach inside AI where the computer learns patterns from data instead of following rules written by hand.
A subset of machine learning that uses neural networks with many layers, strong for images, speech and language.
An interdisciplinary field combining computer science, mathematics and statistics, and domain knowledge to get value from data.
The part of the loop that learns from data and produces predictions, like the student in the classroom analogy.
The true, correct value that a prediction is compared against, like the teacher's solution.
A rule that measures how wrong the model's predictions are compared with the ground truth.
The number produced by the loss function; smaller means the predictions are closer to the truth.
The step where the model changes its internal settings to reduce the loss next time.
Repeating the loop of data, prediction, loss and update many times until predictions become good.