CSwithZain
WhatsApp Join a class

A Level 9618 · Paper 3 · 18.2

Artificial Intelligence: Machine Learning and Neural Networks

How machines learn from data, and the methods behind it. Read the notes, try the past-paper questions, then check the mark scheme.

Past papers from November 2021 to June 202616 questions · 58 marks

Section 18 is one subtopic in the syllabus (18.1). It is split in two here to match the topical booklets: graphs and search, then machine learning.

    In this subtopic

    • Machine learning, deep learning and reinforcement learning, and why each is used
    • Supervised and unsupervised learning
    • How artificial neural networks have helped machine learning
    • Back propagation of errors, and regression

    18.2 · 1 of 11Book pages Contents

    What artificial intelligence is

    Artificial intelligence (AI) can be thought of as a machine with cognitive abilities, such as problem solving and learning from examples. All of these can be measured against human benchmarks, such as reasoning, speech and sight.

    The diagram shows how AI, machine learning and deep learning are linked. Deep learning is a subset of machine learning, and machine learning is itself a subset of AI.

    Three nested boxes. The outer box is AI: intelligent machines think and behave like humans. Inside it is M/L, machine learning: systems learn without being programmed to learn. Inside that is D/L, deep learning: machines think in a way similar to the human brain and handle huge amounts of data using artificial neural networks.
    AI contains machine learning (M/L), which contains deep learning (D/L).
    • AI: intelligent machines think and behave like humans.
    • Machine learning: systems learn without being programmed to learn.
    • Deep learning: machines think in a way similar to the human brain. They handle huge amounts of data using artificial neural networks.

    AI is often split into three categories:

    1. Narrow AI: a machine performs better than a human at one specific task.
    2. General AI: a machine performs about as well as a human at any intellectual task.
    3. Strong AI: a machine performs better than a human at many tasks.

    Examples of AI include:

    • news generation based on live news feeds (this involves some human interaction)
    • smart home devices, such as Amazon Alexa and Apple Siri (these also involve some human interaction).

    A smart home device interacts with a human by recognising their spoken commands. The device learns from its environment and from the data it receives, so its responses become more and more sophisticated. This shows the ability to use automated, repetitive learning through artificial neural networks.

    18.2 · 2 of 11Book page Contents

    Machine learning

    The requirements for machine learning can be summarised as:

    • a computer-based system has a defined task, or tasks, to perform
    • knowledge is gained through the experience of performing the tasks
    • because of this experience and the knowledge gained, the system performs future tasks better.

    The ability to learn from experience is a sign of intelligence. So machine learning is one of the many separate approaches that come under the umbrella of artificial intelligence.

    There are several ways to describe how the learning takes place. Three are covered here: unsupervised learning, supervised learning and reinforcement learning.

    18.2 · 3 of 11Book page Contents

    Unsupervised learning

    In unsupervised learning the system has to draw its own conclusions from its experience of the results of the tasks it has performed. For this, it needs algorithms that can organise or categorise the knowledge it has gained.

    One example is where conceptual clusters are found, based on a hierarchical framework. All the knowledge is first placed in the root of a tree structure. Then, depending on the attributes of the knowledge, selected groups are moved into branches of the tree.

    Today, unsupervised learning is very widely used. Powerful computer systems with access to huge data banks regularly make decisions based on previous actions that have been recorded. Everyone’s activity on the world wide web is recorded and stored, and this stored data is then used to decide which products or services to recommend to them the next time they use the internet. There is no theoretical framework for this: it is as though the intelligence is built into the data.

    18.2 · 4 of 11Book page Contents

    Supervised learning and expert systems

    In supervised learning the system is given knowledge together with its classification. For example, suppose an AI program is being developed to mark exam questions. For supervised learning, it could be given answers to exam questions together with a grade for each one, or with categorised comments.

    A special case of supervised learning is the development of an expert system. An expert system always focuses on a narrowly defined area of knowledge.

    1. Human experts are given samples of data that need analysing.
    2. The experts provide the conclusions to be drawn from the data.
    3. The data and the conclusions are input to the knowledge base.
    4. The system is tested: a human expert provides sample data and checks how accurate the expert system’s conclusions are.
    5. If performance is poor, more data and conclusions are input to the system.

    Note An expert system is an example of AI, but it is not an example of machine learning, because nobody expects the system to improve its performance on its own.

    18.2 · 5 of 11Book page Contents

    Reinforcement learning

    Reinforcement learning has some features like unsupervised learning and other features like supervised learning. It has its own vocabulary, used in these statements about how a reinforcement learning algorithm works:

    • An agent is learning how best to perform in an environment.
    • The environment has many defined states.
    • At each step the agent takes an action.
    • The agent has a policy that guides its actions.
    • The policy is influenced by the recorded history and by knowledge of the current state of the environment.
    • An action changes the environment to a new state.
    • After an action, the agent receives a reward. The reward measures how well the action helped towards the overall goal.
    • The policy guides the agent in deciding whether the next action should exploit knowledge it already has, or explore a new avenue.

    In summary, the aim is to make the reward values as large as possible by improving the quality of the policy. It is a trial-and-error search for the best performance, and it needs many repeated attempts at the same problem.

    This description is abstract. It becomes clearer with some examples of where it is used:

    • playing logic games, such as backgammon
    • robotics, where a robot has to learn how to become good at a task
    • learning how to find a way through a maze. When the agent chooses a left turn that will eventually lead to the destination, the reward is given a positive number. If it chooses a right turn instead, the reward is given a negative number.

    18.2 · 6 of 11Book page Contents

    Comparing the types of learning

    Supervised learning

    • Using known tasks with given outcomes to enable a computer program to improve its performance in accomplishing similar tasks.

    Unsupervised learning

    • Using a large number of tasks with unknown outcomes to enable a computer program to improve its performance in accomplishing similar tasks.

    Reinforcement learning

    • Using a large number of tasks with unknown outcomes, and the use of feedback, to enable a computer program to improve its performance in accomplishing similar tasks.

    Why use each type of learning

    • Supervised learning: when you have labelled data, that is, past data where the right answer is already known, such as emails already marked as spam or not spam. The system learns to predict the answer for new data.
    • Unsupervised learning: when the data has no labels. The system finds patterns and groups by itself, for example grouping customers with similar buying habits.
    • Reinforcement learning: when there is no fixed right answer, but the system can try actions and be rewarded or penalised, for example a program learning to play a game.
    • Deep learning: for very complex data such as images, speech and language, where many hidden layers are needed to pick out features. It needs a lot of data and computing power.

    18.2 · 7 of 11Book pages Contents

    Regression analysis

    In some applications, the aim of the AI is to predict numerical values for one quantity, from data values for other quantities that are input to the AI algorithm.

    To use regression analysis, the system is first given some real values, both for the input data and for what will become the output data once the AI system is in use. This data is used to find out whether there is any correlation between the two sets of values. If a correlation is found that can be written as a mathematical formula, that formula can then be used to output predicted values when new data is input.

    The simplest use of regression analysis is when values for only one quantity are input, and a linear (straight-line) relationship is expected between these values and the values to be predicted.

    For example, an AI system could be used to predict candidates’ marks in an A Level Computer Science exam. There may be a correlation between a candidate’s mark in A Level Computer Science and their mark in IGCSE Mathematics. The graph shows what might be found when some historic data is input and analysed.

    Scatter graph with IGCSE Maths mark (0 to 80) on the horizontal axis and A Level Computer Science mark (0 to 80) on the vertical axis. Ten points lie close to a straight best-fit line that rises from about 5 on the horizontal axis up to about 55 marks.
    Historic marks with the straight line of best fit.

    There is good correlation between the two sets of marks. The straight line is the one calculated as the best fit to the data. The formula for this line can sensibly be used to predict future A Level Computer Science marks from the marks scored in an IGCSE Mathematics paper.

    Regression analysis can be more complicated:

    • a similar fitting to a mathematical formula can be done when the marks for three different exams are used as the input
    • in other cases a non-linear relationship might suit the data better, for example when predicting the future sales of a new product whose sales are expected to grow exponentially.

    18.2 · 8 of 11Book page Contents

    Artificial neural networks

    The neural networks in our brains give us our intelligence, so it makes sense to use artificial neural networks as a foundation for artificial intelligence systems.

    In the brain, one end of a nerve cell has many dendrites, which can receive signals. The other end has many axon terminal buttons, which can transmit signals. The synapse is the region between an axon terminal button and a dendrite, and it contains neurotransmitters. When a nerve cell receives input signals, the voltage in the axon increases. At a certain threshold value of this voltage, the neurotransmitters are activated and signals are sent to the dendrites of the cells next to it.

    An artificial neural network can be created in software or in hardware. Its parts can be shown in a diagram like the one below. The triangles are the nodes of the network, which represent artificial neurons (sometimes they are drawn as circles).

    An artificial neural network drawn as blue triangles joined by arrows. Three input nodes on the left each receive three input arrows. Each input node connects to both of the two nodes in the middle column, and each middle node connects to all three output nodes on the right, which each give one output arrow.
    A simple artificial neural network: input layer, one hidden layer, output layer.

    In general, a node can receive one or more inputs and can send an output to one or more other nodes. To model what a node does:

    1. a weighting factor is applied to each input
    2. the weighted input values are added together
    3. an activation function is used to calculate the output value of the node.

    If an input is not a number, it must be converted to one, so that the weighted values can be added together.

    18.2 · 9 of 11Book page Contents

    Layers in a neural network

    The diagram above shows a very simple network with three layers:

    • the input layer: the column of three nodes on the left, which receives the input
    • the hidden layer: the two nodes in the middle
    • the output layer: the column on the right, which provides the output.

    Some artificial neural networks have several hidden layers.

    One example of an AI system that uses an artificial neural network estimates how cost-effective batteries are. Each input node takes one feature of a battery, such as its price, its type or the device it is used in. The hidden layer combines these features, and the output node gives an estimated cost per unit of time for that battery.

    18.2 · 10 of 11Book page Contents

    Back propagation of errors

    Each connection between two nodes has a weight. When the network is first set up, the weights are given trial values. They are then tuned using back propagation of errors. This needs real data where the answer is already known: in the battery example, the real cost per unit of time of some batteries, worked out from their price and how long they actually lasted.

    1. Input the training data and let the network calculate its outputs.
    2. Compare each output with the known correct value to find the error.
    3. Send the error backwards, from the output layer through the hidden layers.
    4. Adjust each weight according to how much it added to the error.
    5. Repeat many times, until the error is small enough.

    When more real data becomes available, back propagation can be run again to improve the predictions.

    18.2 · 11 of 11Book pages Contents

    Deep learning

    In the brain, neurons are thought to be arranged in layers. The lower layers have functions that are easy to understand, but the higher layers deal with more abstract processing of information. With the computing power now available, artificial neural networks are being built with large numbers of hidden layers that try to do something similar. These are known as deep learning systems.

    Neural networks enabling machine learning

    • Artificial neural networks are intended to copy the way human brains work.
    • Weights (values) are assigned to each connection between nodes.
    • The data is input at the input layer and passed into the system.
    • It is analysed at each following (hidden) layer, where characteristics are extracted or outputs are calculated.
    • This process of training (learning) is repeated many times to get the best outputs, or reinforcement learning takes place.
    • Decisions can be made without being specifically programmed.
    • The deep learning net will have created complex feature detectors.
    • The output layer provides the results.
    • Back propagation (of errors) is used to correct any errors that have been made.

    Reasons for multiple hidden layers

    • They enable deep learning to take place.
    • A problem with a higher level of complexity needs more layers to solve it.
    • They enable the neural network to learn and make decisions on its own.
    • They improve the accuracy of the result.

    18.2

    Concepts in 18.2

    Every idea explained in 18.2, and where else in the notes it is used.

    ConceptIn one lineAlso used in
    activation functionThe function that turns a node’s summed weighted inputs into its output value.only here
    artificial intelligenceA machine with cognitive abilities such as problem solving and learning from examples.18.2 Machine learning, 18.2 Artificial neural networks, 18.1 Graphs: nodes, edges and routes
    artificial neural networkLayers of connected nodes (artificial neurons) with weighted connections, modelled on the brain.18.2 What artificial intelligence is, 18.2 Layers in a neural network, 18.2 Deep learning, 18.1 Why graphs are used in AI
    artificial neuronA node in a neural network: it weights its inputs, adds them and applies an activation function.only here
    back propagation of errorsSending the output error backwards through the network and adjusting each weight to reduce it.18.2 Deep learning, 18.1 Why graphs are used in AI
    conceptual clustersGroups of knowledge moved from the root of a tree into branches, by their attributes.only here
    deep learningMachine learning with artificial neural networks that have many hidden layers.18.2 What artificial intelligence is, 18.2 Comparing the types of learning
    expert systemAn AI system built from experts’ data and conclusions in a narrow area; it does not improve unaided.only here
    general AIA machine that performs about as well as a human at any intellectual task.only here
    hidden layerA layer of nodes between the input layer and the output layer of a neural network.18.2 Comparing the types of learning, 18.2 Back propagation of errors, 18.2 Deep learning
    labelled dataPast data where the right answer is already known, used for supervised learning.only here
    machine learningA system that gains knowledge by performing tasks and so performs future tasks better.18.2 What artificial intelligence is, 18.2 Supervised learning and expert systems, 18.2 Deep learning, 18.1 Why graphs are used in AI
    narrow AIA machine that performs better than a human at one specific task.only here
    regression analysisFinding a formula that fits the correlation in real data, then using it to predict new values.18.1 Why graphs are used in AI
    reinforcement learningTrial-and-error learning where an agent’s actions earn rewards, and it improves its policy to maximise them.18.2 Machine learning, 18.2 Comparing the types of learning, 18.2 Deep learning
    strong AIA machine that performs better than a human at many tasks.only here
    supervised learningLearning from known tasks with given outcomes: data is given with its classification.18.2 Machine learning, 18.2 Reinforcement learning, 18.2 Comparing the types of learning
    unsupervised learningLearning from many tasks with unknown outcomes: the system finds patterns and groups by itself.18.2 Machine learning, 18.2 Reinforcement learning, 18.2 Comparing the types of learning
    weighting factorThe weight a node applies to an input before the inputs are added together.only here

    When you want more than reading

    The notes are the front door. The class is where it clicks.

    Join a class →Ask on WhatsApp