Đại học Kinh tế Quốc dân – National Economics UniversityMICRO4ASIA
🏆 Arena
Sign inSign up
MICRO4ASIAThe six micro-credentials

Courses are delivered on the Limio learning platform. Limio

← Fundamental of Machine Learning

You are viewing a public preview

Sign in to save your progress, do assignments, join discussions and get feedback.

Sign in
Module 1: Data Preparation and Model Foundations

1.1 How Machines Learn

Print / Save as PDF

1.1 How Machines Learn

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.

Key Points

  • Venn diagram: Computer Science ⊃ AI ⊃ Machine Learning ⊃ Deep Learning; Data Science is a field that overlaps with them.
  • Data Science sits at the intersection of Computer Science, Mathematics & Statistics and Domain Knowledge.
  • Humans learn through a loop: do the exercise → submit it → the teacher grades it against the solution → get a result → improve.
  • Machines learn within the same framework: Data → Model → Prediction → Loss function → Update.
  • The loss function (for example MSE) compares the prediction with the ground truth and produces a loss value; the loss value is the signal used to update the model.

Study notes

By the end of this lesson you can:

  • Place computer science, AI, machine learning and deep learning in the right nested order.
  • Explain why data science overlaps with these fields but is not the same thing as machine learning.
  • Describe the human learning loop (exercise, submission, solution, result, improve) and map each part to machine learning terms.
  • Name the five parts of the training loop: data, model, prediction, loss function, update.
  • Compute a simple squared-error loss and say what the model does with it.

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.

From computer science to deep learning

Beginners often hear many related terms and mix them up. The lecture places them inside each other like circles:

FieldWhat it covers
Computer scienceThe 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.

Where data science fits

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.

  • Computer science gives the tools to collect, clean, process, analyse and visualise data.
  • Mathematics and statistics help us understand the data correctly.
  • Domain knowledge tells us what the real-world problem actually is.

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.

How humans learn

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.

How machines learn: the training loop

Machine learning follows almost exactly the same loop, only with new names:

Human learningMachine learning
ExerciseData (the input)
StudentModel (the thing that learns)
SubmissionPrediction
SolutionGround truth (the true value)
Teacher's gradingLoss function
ResultLoss value
ImproveUpdate

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.

Worked example

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.

Common mistakes

  • Treating AI, ML and data science as synonyms. ML is one approach inside AI; data science is a broader, interdisciplinary field that may or may not use ML.
  • Thinking deep learning is separate from machine learning. Deep learning is a subset of machine learning that uses many-layered neural networks.
  • Confusing the loss function with the loss value. The function is the rule for measuring error (for example MSE); the value is the number it produces for one set of predictions.
  • Thinking the model learns in one pass. Training is a loop that repeats many times; one comparison is not enough.

Summary

  • Computer science contains AI, AI contains machine learning, and machine learning contains deep learning.
  • Data science combines computer science, mathematics and statistics, and domain knowledge.
  • Humans learn by attempting, comparing with a solution, getting a result and improving.
  • Machines learn through Data, Model, Prediction, Loss function and Update.
  • The loss value is the feedback signal the model uses to update itself; repeating the loop is training.

Flashcards · 1.1 How Machines Learn

10 words
WordMeaningExample
  • Artificial intelligence (AI)

    The part of computer science that builds systems able to do tasks that normally need human intelligence.

    Recognising images, understanding language, making decisions.

  • Machine learning

    An approach inside AI where the computer learns patterns from data instead of following rules written by hand.

    Learning house prices from past sales instead of coding a price formula.

  • Deep learning

    A subset of machine learning that uses neural networks with many layers, strong for images, speech and language.

    Classifying photos of cats and dogs with a neural network.

  • Data science

    An interdisciplinary field combining computer science, mathematics and statistics, and domain knowledge to get value from data.

    Cleaning sales data, finding insights, building a model, reporting results.

  • Model

    The part of the loop that learns from data and produces predictions, like the student in the classroom analogy.

    y = w * x, where w is learned.

  • Ground truth

    The true, correct value that a prediction is compared against, like the teacher's solution.

    The actual selling price of a house.

  • Loss function

    A rule that measures how wrong the model's predictions are compared with the ground truth.

    MSE: mean((prediction - y) ** 2)

  • Loss value

    The number produced by the loss function; smaller means the predictions are closer to the truth.

    Predict 3.0, truth 3.2: squared error = 0.04.

  • Update

    The step where the model changes its internal settings to reduce the loss next time.

    w = w - learning_rate * gradient

  • Training

    Repeating the loop of data, prediction, loss and update many times until predictions become good.

    Running the update loop thousands of times.