Simulators
A4 · concepts to know
Read about types of machine learning, suitable hardware, ethical issues, and HL topics on preparing data and choosing models. The sections link to relevant demos where available.
For A4.1.1 you need to describe each type of machine learning and a real-world use for it. Most types have a demo here.
Learns from labelled examples, where each input comes with its known answer, then predicts the answer for new inputs. Used for classification (discrete labels, like marking an email as spam or not) and regression (continuous values, like predicting a house price).
k-NN demoUnsupervised learning finds structure in unlabelled data, such as clusters of similar items. Shops can use it to group customers with similar buying habits.
k-means demoIn reinforcement learning, an agent learns from actions and the rewards it receives in an environment. It aims to maximise cumulative reward (reward over a sequence of actions). This approach is used in game-playing systems and robotics.
grid-world demoDeep learning uses artificial neural networks with many layers. These learn features from data such as images and text. It is used in image recognition and language models.
CNN demoTransfer learning adapts a model trained on one task for a related task. Reusing learned features can reduce the data and training time needed. For example, an image model can be adapted to identify plant diseases by retraining its final layers.
For A4.1.2 you need to describe which hardware suits each situation where machine learning is used, and why.
Graphics Processing Units (GPUs) perform many calculations in parallel. This suits the matrix calculations used to train neural networks.
practise the GPU questionTensor Processing Units (TPUs) are chips Google designed for neural-network calculations. They are specialised for efficient matrix operations, with less flexibility than general-purpose processors.
Application-Specific Integrated Circuits (ASICs) have hardware designed for a particular purpose. They can offer high speed and low power use for that work. The hardware design is fixed after manufacture, but some ASICs can run different programs or models. A TPU is an ASIC designed for machine learning.
Field-Programmable Gate Arrays (FPGAs) have hardware that can be reconfigured after manufacture. They can accelerate suitable tasks while allowing the hardware design to change. They are useful for prototyping and for devices whose processing requirements may change.
Cloud platforms provide computing resources on demand. High-performance computing (HPC) centres provide powerful systems. Both can support large training tasks.
For A4.4, discuss the ethical implications of machine learning. Use the two activities below to practise considering different perspectives.
The syllabus lists accountability, fairness, bias, consent, privacy, security and environmental impact. A model can be accurate overall and still treat one group unfairly, so high accuracy on its own does not show that a model is fair.
accuracy-vs-fairness demoYou get better at ethical reasoning by practising it on real cases. Take a position on a real machine learning scenario and defend it, with CSBot arguing the other side.
Ethics CourtAs AI, augmented reality (AR), virtual reality (VR) and quantum computing become part of everyday life, weigh their benefits against individual rights, privacy and equity. For each one, ask who benefits and who could be harmed.
The HL-only A4 topics that the demos do not cover directly.
Real data is messy: missing values, duplicates, inconsistent formats, outliers. Cleaning it first matters because a model can only learn from the data it is given, errors and all.
Feature selection means choosing which inputs (features) the model uses. Filter methods rank features with a statistic before training. Wrapper methods train the model on different sets of features and keep the best set. Embedded methods choose features during training. Fewer, more useful features usually make a model faster and better at working on new data.
Dimensionality reduction uses fewer features while preserving useful information. It can reduce training time and overfitting. The syllabus requires the purpose and benefits, without the details of methods such as PCA and LDA.
A decision tree classifies an item by testing its features. Each result leads along a branch to a leaf that gives the predicted category. During training, the algorithm chooses splits that separate the classes. You can follow the path to explain a prediction. The syllabus includes decision trees and k-NN for classification.
Hyperparameters are settings chosen outside the values learned during training, such as k, polynomial degree and learning rate. Tuning compares settings on a validation set using a suitable measure, such as accuracy, precision, recall or F1 score. The aim is to perform well on new data. Several sliders here change hyperparameters.
metrics demoAssociation rule learning finds relationships between attributes across records. Market basket analysis uses it to find items often bought together. Rules can take the form "if bread and butter, then milk". Support measures how often all these items occur together. Confidence measures how often milk occurs among purchases containing bread and butter.
No single algorithm is best for every problem. Compare the candidate models fairly by testing them all on the same unseen data, using a metric that suits the task. Then choose, weighing the score against trade-offs such as speed and how easy the model is to explain.
metrics demo