← IB Computer Science

A4.1 · Book pp. 206–214

Machine learning fundamentals

Your level

Instead of writing every rule by hand, we show a computer examples and let it find the rules. This section explains the main ways of doing that, and the hardware they need.

What you need to know

  • A4.1.1 Describe the types of machine learning and their real-world applications.
  • A4.1.2 Describe the hardware requirements for various scenarios.

Both are for SL and HL. Precise terms matter here, since a term used in the wrong context costs marks.

AI, ML and deep learning

Artificial intelligence Machine learning Deep learning
Original diagram: each field sits inside the wider one.
  • Artificial intelligence imitates human intelligence. Narrow AI does specific tasks and is all that exists today. General AI would work at human level across domains.
  • Machine learning learns from data without being explicitly programmed.
  • Generative AI produces text, images, audio or video, usually from a prompt.

Next: types of machine learning →

A4.1.1 Types of machine learning

TypeLearns fromResultExamples
SupervisedLabelled examples: inputs with the right answersPredicts a number (regression) or a category (classification)Grade prediction, spam filters, handwriting
UnsupervisedData with no labelsFinds patterns and groups by itselfSocial groups, shopping patterns, recommendations
ReinforcementTrial and error, with rewards as feedbackImproves its decisions over timeGame bots, robots, self-driving, trading
TransferA trained model, adapted to a related taskNeeds far less data and timeGeneral image model tuned to recognize flowers
Deep learningNeural networks with many layersExtracts higher-level features layer by layerImage and speech recognition

✏️ Book note

The book says “deep learning” implies a neural network. More exactly, “deep” means a network with many hidden layers, as its own common-mistake box says. The term has nothing to do with deep understanding.

⚠️ Common mistakes

  • Deep learning is part of machine learning, not separate from it.
  • Regression gives numbers, and classification gives categories.
  • Transfer learning means adapting a model to a related task, not just reusing it unchanged.

🔬 Lab: name the approach

Next: computing platforms →

A4.1.2 Computing platforms

Exact models will change, so learn the categories and the trade-offs.

PlatformBest forAdvantageLimitation
Standard laptopLearning, small modelsCheap and availableToo slow, with limited memory for big models
Workstation with GPUSerious individual projectsOften around 10× faster than a CPU aloneCosts more up front
Edge deviceProcessing next to the dataLess data sent, so better privacy and latencyYou buy and maintain the hardware
Cloud platformTraining and deploying large modelsScales on demand, and no hardware to ownDependence on a provider, security trust, ongoing cost
HPC centreLarge scientific researchSustained, very high performanceRestricted access through membership or grants

✍️ Try it

Google Colab lets you run a Python notebook on a GPU or TPU. Change the setting in its Runtime menu, then compare how long a matrix calculation takes.

Next: processors →

A4.1.2 Processors for machine learning

ChipBuilt forStrengthWeakness
CPUGeneral purposeFlexible, handles complex tasksWeak at heavy parallel work
NPUNeural network maths on consumer devicesFast and low powerLimited to smaller workloads
GPUThe same calculation on many values at onceExcellent at matrix and vector mathsCostly and power-hungry
TPUGoogle’s chip for tensor maths at low precisionVery efficient at huge matrix workTied to certain platforms
ASICCustom chip for one fixed taskPeak speed and efficiency, cheap at scaleHigh design cost, cannot be reprogrammed
FPGAReprogrammable hardwareBalances flexibility and efficiencyHarder to program, and less efficient than an ASIC

scalar (0D) → vector (1D) → matrix (2D) → tensor (3D or more)

🔬 Lab: pick the hardware

Work through the questions to narrow down your choice.

✏️ Book note

The book says a CPU must queue calculations one by one. Modern CPUs do have several cores and some parallel instructions, but only a handful of cores compared with a GPU’s thousands. That is the difference to describe.

Next: review →

Quick quiz

1. How do AI, ML and deep learning relate?
2. Which AI exists today?
3. Predicting a house price is…
4. Sorting email into spam or not is…
5. A robot learning to walk from falls and successes uses…
6. Fine-tuning a general speech model for one accent is…
7. Why are GPUs good for machine learning?
8. Which chip can be reprogrammed after it is made?
9. What is a tensor?

Exam-style questions

These are written for this site in the style of Paper 1. Answer on paper first, then open the mark points.

  1. Distinguish between regression and classification. [2]

    Mark points
    • Regression predicts a continuous numerical value [1].
    • Classification predicts a category from a discrete set [1].
  2. An email client sorts messages into Primary, Social and Spam. Identify the type of learning and justify your choice. [3]

    Mark points
    • Supervised learning [1].
    • It is trained on emails labelled with the correct folder [1].
    • It then generalizes to place new, unseen emails in a known category [1].
  3. A self-driving model trained in one city is adapted for another. Define transfer learning, and outline how this example fits it, with one limitation. [4]

    Mark points
    • Transfer learning applies a trained model to a similar new problem [1].
    • Skills such as recognizing cars and signs carry over [1].
    • Only local fine-tuning is needed, which saves data and time [1].
    • Limitation: different traffic rules or signs may reduce accuracy [1].
  4. A start-up will process real-time data on a large scale. Identify suitable hardware and outline a limitation. [3]

    Mark points
    • A GPU [1].
    • Its parallel cores process large amounts of data at once with low delay [1].
    • Limitation: high purchase and energy costs [1].
  5. A university wants to analyse lectures in real time. Compare using cloud GPUs and an on-site edge device. [4]

    Mark points
    • Cloud GPUs scale on demand [1], with no hardware to maintain [1].
    • Edge devices keep video on-site, which helps privacy [1], and reduce latency and bandwidth use [1].