Machine Learning and Artificial Intelligence

Leaving Cert Higher Level Computer Science revision notes with diagrams, key terms and self-check questions.

14 min readHigher LevelBy Studytok
Practise this topic — free →

Artificial intelligence and machine learning represent a fundamental shift from traditional hand-coded programs to systems that detect patterns in data. In Leaving Certificate Computer Science, you need to understand the distinction between narrow AI and artificial general intelligence, master the four core learning paradigms, explain the machine learning lifecycle, and evaluate named techniques like neural networks, decision trees, and nearest-neighbour algorithms. You must also evaluate when machine learning is appropriate compared to deterministic programming, and critically assess the social, ethical, and environmental impacts of AI on culture and daily life.

Understanding Artificial Intelligence: Narrow AI, AGI, and the Turing Test

Artificial intelligence (AI) is the broad field of computer science dedicated to building systems capable of performing tasks that traditionally require human intelligence, such as visual perception, speech recognition, decision-making, and language translation. To understand how AI relates to other terms, picture a nested hierarchy: artificial intelligence is the overall discipline, machine learning is a method within AI where systems learn from data instead of hand-written rules, and deep learning is a specialised branch of machine learning that uses multi-layered neural networks.

Computer scientists classify AI into distinct capability tiers:

  • Narrow AI (Weak AI): Systems designed and trained to perform one specific task. They cannot apply their skills to an unrelated problem. Every working AI system in existence today—from web search algorithms and chess engines to speech-to-text assistants and medical scanners—is narrow AI.
  • Artificial General Intelligence (AGI or Strong AI): A theoretical system that possesses adaptable, human-like reasoning across many different domains. An AGI could learn new subjects independently, transfer knowledge between fields, and solve unfamiliar problems without human intervention. No AGI system exists today.
  • Superintelligent AI: A hypothetical system that would be far more capable than the best human minds across every discipline. It is a theoretical concept and is not an active technology.

The Turing Test

Proposed by Alan Turing in 1950, the Turing test provides a practical benchmark for the question "can a machine think?". A human judge holds a blind, text-based conversation with two hidden participants: one human and one computer system. If the judge cannot reliably tell which participant is the machine, the system is said to have passed.

When evaluating the Turing test in an exam, note its main limitation: it measures only the imitation of human conversational behaviour, not genuine understanding. A system can generate convincing text responses using statistical patterns without comprehending any of the words it outputs.

Machine Learning: Key Concepts and the Six-Stage Lifecycle

Machine learning (ML) inverts classical software engineering. In traditional programming, a developer writes explicit logical rules that take input data and calculate an output. In machine learning, the computer takes input data alongside known outputs to discover the underlying patterns and produce its own rules automatically.

Two fundamental terms underpin all dataset preparation:

  • A feature is an individual measurable property or variable used as an input (for instance, the length of an email, the price of a house, or pixel brightness in an image).
  • A label is the known, correct outcome or target attached to a training record (for example, 'spam' or 'ham', or a confirmed medical diagnosis).

Building an effective machine learning system follows a structured six-stage lifecycle:

  1. Define the task: determine what the system must predict and select an evaluation metric to measure performance.
  2. Prepare the data: collect raw records, clean invalid formatting, handle missing entries, and extract informative features.
  3. Separate the data: split the dataset into separate training data and test data sets (typically an 80/20 split). Keeping test data completely hidden during training guarantees that evaluation measures how well the system handles new situations.
  4. Train the model: feed the training data into the learning algorithm to discover relationships between features and target labels.
  5. Evaluate the model: test the trained model on the unseen test data to calculate performance metrics such as accuracy, and inspect errors.
  6. Deploy and monitor: integrate the model into a live application, continuously checking that predictions remain accurate as real-world data patterns shift.

Example Lifecycle Scenario

A school develops a system to identify students who need additional mathematics support:

  • Task definition: predict whether a student needs extra support ('yes' or 'no'), measured by classification accuracy.
  • Data preparation: clean student attendance logs and assessment marks, replacing blank test records.
  • Data separation: use records from 2019 to 2023 for training, holding back 2024 records as the test set.
  • Model training: fit a decision tree to link historical attendance and homework submission rates to outcomes.
  • Model evaluation: measure accuracy on the unseen 2024 test data to check for errors.
  • Deployment and monitoring: run the tool each autumn, checking yearly that changes in the mathematics syllabus do not invalidate predictions.

Generalisation, Overfitting, and Underfitting

Inference is the act of passing new, unseen input features into a trained model to calculate a prediction.

  • Overfitting happens when a model learns the training data too closely, memorising random noise and minor quirks. It scores extremely high accuracy during training but performs poorly on new, unseen test data.
  • Underfitting happens when a model is too simple to capture the underlying trend in the data. It performs poorly on both the training data and new test data.

The Four Machine Learning Paradigms

Choosing an algorithm depends on whether ground-truth answers exist and how feedback is gathered:

ParadigmData StructureHow It OperatesPractical Example
Supervised LearningLabelled data (input features paired with correct output labels)Learns a mapping function from inputs to outputs to predict labels on unseen instances.Identifying fraudulent bank transactions, filtering email spam, automated medical imaging diagnosis.
Unsupervised LearningUnlabelled data (raw input features without target answers)Discovers natural patterns, clusters, or hidden structures inside the data without guidance.Customer market segmentation, grouping documents by topic, anomaly detection in network traffic.
Semi-Supervised LearningA small amount of labelled data combined with a large volume of unlabelled dataThe small labelled set teaches the model basic rules, while the unlabelled data reveals the broader distribution.Medical image analysis where only a few hundred scans have been annotated by specialist doctors.
Reinforcement LearningEnvironmental states and reward feedbackAn agent takes actions inside an environment through trial and error to maximise its cumulative numerical reward.Training autonomous driving vehicles, robotic arm control, automated game playing.

Supervised learning splits into two distinct problem types:

  • Classification: predicting a discrete category or label (e.g. deciding whether a parcel is small, medium, or large, or whether an email is spam).
  • Regression: predicting a continuous numerical value (e.g. estimating travel time in minutes or forecasting home energy consumption in kilowatt-hours).

In unsupervised learning, clustering groups records based on geometric or statistical similarity. The algorithm creates the groups, but human domain experts must inspect the clusters to interpret what each group means.

A reinforcement learning system is defined by five connected components:

  1. The agent: the decision-maker or learner.
  2. The environment: the external world or simulation the agent operates within.
  3. The state: the current situation or configuration of the environment.
  4. The action: any decision or movement the agent chooses to execute.
  5. The reward: numerical feedback (positive points or negative penalties) returned by the environment to signal success or failure.
An agent sends an action to the environment and receives the resulting state and reward.
An agent sends an action to the environment and receives the resulting state and reward.

Named AI and Machine Learning Techniques

Syllabus outcome 1.14 requires you to explain what algorithms might be used across practical contexts. You should be familiar with the following core techniques:

Artificial Neural Network (ANN)

An artificial neural network is a computational model inspired by biological nervous systems. It consists of interconnected processing units called nodes, organised into layers:

  • An input layer: receives individual feature values (one node per input feature).
  • One or more hidden layers: intermediate nodes that apply mathematical calculations to extract patterns.
  • An output layer: produces the final classification probability or numerical estimate.

Every connection between nodes has an assigned weight. Each node computes a weighted sum of its inputs and passes the value through an activation function. Training involves feeding input data forward, comparing the output to the known label, and using an algorithm to adjust the weights backwards to minimise prediction error. When an artificial neural network contains many hidden layers, it is termed deep learning. Neural networks excel at computer vision and speech recognition, but they suffer from the 'black box' problem: because decisions rely on millions of adjusted weights, humans cannot easily trace why a specific decision was reached.

Feature inputs connect through a hidden layer of processing nodes to an output, with a weight marked on one connection.
Feature inputs connect through a hidden layer of processing nodes to an output, with a weight marked on one connection.

Decision Tree

A decision tree classifies data by passing an item down a hierarchy of yes/no conditional questions based on feature values. Each internal node tests a feature, each branch represents an outcome of the test, and each leaf node provides the final predicted label. Because the full logic is immediately visible as an explicit flowchart, decision trees possess intrinsic interpretability—humans can easily audit and explain every step of the decision.

k-Means Clustering

k-means clustering is an unsupervised algorithm that groups unlabelled data into k distinct clusters:

  1. Choose the number of clusters, k, and randomly place k initial centre points (centroids).
  2. Assign each data point to its nearest centroid based on distance.
  3. Recalculate each centroid's position by taking the average coordinate of all points assigned to that cluster.
  4. Repeat steps 2 and 3 until the centroids no longer move. It is widely used in retail to group shoppers by buying habits.

k-Nearest Neighbours (k-NN)

k-NN is an instance-based algorithm that classifies a new, unseen item by measuring its distance to all stored training examples. It selects the k closest records and takes a majority vote to assign the final category.

Rule-Based (Expert) System

An expert system is a traditional AI approach that does not use machine learning. It relies on a knowledge base of hand-crafted IF–THEN rules designed by human specialists, paired with an inference engine that applies those rules logically to user inputs. Expert systems are 100% explainable and deterministic, but they cannot adapt or learn from data; modifying the system requires an engineer to add or edit rules manually.

Choosing the Right Tool: Machine Learning vs Traditional Programming

The syllabus asks you to explain when and what machine learning and AI algorithms might be used in certain contexts. Machine learning is not appropriate for every computational problem.

When to Use Traditional Programming

  • The problem is governed by clear, unambiguous mathematical or logical rules (for example, applying a 23% VAT rate to a shopping basket, calculating PAYE tax, or sorting an array of student IDs).
  • The solution requires absolute determinism and 100% precision on every single run.
  • Training data does not exist or is too expensive to collect.
  • The process must be fully verifiable for safety audits or legal compliance, where probabilistic approximations cannot be accepted.

When to Use Machine Learning

  • The task involves perceptual or pattern-recognition challenges that cannot be reduced to simple manual rules (such as identifying pedestrians in automated driving cameras or filtering speech with varied background noise).
  • Large volumes of relevant, high-quality historical data are readily available.
  • Patterns shift over time, requiring the software to update its logic automatically from new incoming records.
  • A statistical approximation is acceptable, especially when combined with human review for unusual edge cases.

Using Heuristics

When an exact algorithmic solution requires too much computing time or power to evaluate every possibility, computer scientists employ a heuristic. A heuristic is a practical problem-solving shortcut or rule of thumb that finds an approximate, satisfactory solution quickly when classic exhaustive methods are computationally unfeasible. Using a heuristic often involves trading away guaranteed optimal precision or absolute completeness to gain practical speed.

Data Quality, Imbalance, and Algorithmic Bias

A machine learning system is only as reliable as the data used to train it. Flawed training data directly degrades real-world performance through several common defects:

  • Missing values: caused by sensor failures, dropped internet packets, or omitted questionnaire fields.
  • Inconsistent formats: mixing imperial and metric units, or combining dates stored under differing international standards.
  • Outliers: extreme anomalies caused by recording equipment errors that pull model parameters off course.
  • Imbalanced data: a dataset where one target label dramatically outnumbers another (for instance, 995 legitimate card transactions to 5 fraudulent ones).

Model accuracy is expressed in words and as a formula:

Accuracy=Correct PredictionsTotal Predictions×100%\text{Accuracy} = \frac{\text{Correct Predictions}}{\text{Total Predictions}} \times 100\%Accuracy=correct predictions÷total predictions×100%\text{Accuracy} = \text{correct predictions} \div \text{total predictions} \times 100\%

On heavily imbalanced datasets, overall accuracy gives a false sense of success. A model that simply labels every transaction as 'legitimate' achieves 99.5% accuracy while completely failing to detect fraud.

Algorithmic Bias

Algorithmic bias occurs when an automated system produces systematically unfair, skewed, or discriminatory outcomes against specific groups of people. Leaving Certificate marking schemes look for three connected ideas:

  1. Bias originates in the data: historical human prejudices in past decisions (such as biased mortgage approvals) or unrepresentative sampling (such as facial recognition systems trained primarily on lighter skin tones) enter the training set.
  2. The algorithm learns and codifies these imbalances: the model assumes past disparities represent correct ground-truth rules.
  3. The result is unfair output: real users experience discriminatory, inaccurate decisions in high-stakes areas like hiring, credit scoring, or policing.

Bias can also stem from developer design choices—such as selecting which features to measure or choosing how to define 'success' mathematically.

Ways to Reduce Bias

  • Audit datasets to ensure every demographic group is represented in sufficient numbers.
  • Measure error rates separately across individual sub-groups rather than looking only at global accuracy.
  • Rebalance training datasets by gathering more minority-class data or applying statistical weighting adjustments.
  • Keep a human specialist in the loop to review high-stakes automated decisions.

AI, Ethics, and Society: Benefits, Risks, and Accountability

Outcome 1.12 asks you to compare the positive and negative impacts of computing on culture and society, while outcome 1.11 addresses ethics. Extended discussion questions require balanced arguments on both sides, specific examples, and a reasoned conclusion.

Positive Impacts of AI

  • Healthcare: computer vision models analyse thousands of MRI and CT scans to flag early tumours or eye disease faster than manual scanning, allowing doctors to prioritise urgent cases.
  • Accessibility: automated speech-to-text, live subtitles, screen readers, and image description tools allow people with sensory impairments to navigate software independently.
  • Safety and fraud prevention: financial algorithms catch fraudulent payment attempts in milliseconds; automated email spam filters block malicious phishing links before workers click on them.
  • Environmental efficiency: smart energy grids and route-optimisation algorithms reduce fuel consumption and cut carbon emissions in logistics.
  • Productivity: automated translation tools, summarisation tools, and coding assistants handle repetitive tasks, freeing workers for creative problem solving.

Negative Impacts of AI

  • Employment and displacement: automated systems displace routine roles (such as telephone support, data entry, and basic document processing) faster than displaced workers can retrain.
  • Discrimination and inequality: biased training data creates automated barriers in hiring platforms and credit-scoring tools.
  • Privacy and mass surveillance: training models requires massive personal datasets (location histories, photos, browsing habits). Public camera networks with facial recognition enable invasive tracking.
  • Misinformation and deepfakes: generative tools allow bad actors to produce convincing fake video, audio, and news articles, undermining public trust.
  • Deskilling and over-reliance: professionals who depend uncritically on automated recommendations can lose fundamental diagnostic or analytical skills.
  • Energy and water consumption: training state-of-the-art models consumes immense electrical power and millions of litres of water to cool data centres.

Data Protection and Accountability

Under the General Data Protection Regulation (GDPR), personal data must be gathered lawfully for a clear purpose, and individuals have rights to know how their data is processed and to request human intervention for automated decisions. When an automated system causes harm (such as an autonomous vehicle crash or an unlawful credit refusal), questions of accountability arise: is legal responsibility held by the software developer, the deploying enterprise, or the operator?

Explainable AI (XAI)

When models act as black boxes, explainable AI methods help humans understand why predictions were made:

  • Intrinsic interpretability: models simple enough for direct human inspection (such as a short decision tree).
  • Post-hoc interpretability: analytical tools applied after training a complex model to highlight which input features had the greatest mathematical impact on a given output.

Key terms

Artificial Intelligence (AI)
The branch of computer science focused on building software or hardware systems capable of performing tasks that traditionally require human intelligence.
Narrow AI
An AI system built and trained to carry out one specific task without the capacity to transfer its learning to other domains.
Artificial General Intelligence (AGI)
A theoretical system possessing adaptable, human-like cognitive abilities across multiple domains, capable of solving novel problems autonomously.
Machine Learning
A subset of artificial intelligence where systems detect patterns in data to improve task performance without being explicitly programmed with fixed rules.
Supervised Learning
A machine learning paradigm where models train on labelled datasets containing paired input features and known target outputs.
Unsupervised Learning
A machine learning paradigm where algorithms analyse unlabelled data to uncover natural structures, groupings, or clusters without predefined targets.
Semi-Supervised Learning
A machine learning method that trains on a small amount of labelled data combined with a large volume of unlabelled data.
Reinforcement Learning
A machine learning framework where an agent learns an optimal action strategy by interacting with an environment to maximise cumulative reward.
Feature
An individual measurable property or variable of an item used as an input to a machine learning model.
Label
The known, verified output category or numerical target value attached to an item in a supervised training dataset.
Classification
A supervised learning task where the model predicts a discrete category or qualitative class label.
Regression
A supervised learning task where the model predicts a continuous numerical quantity.
Clustering
An unsupervised learning process of grouping data points together based on their mathematical or geometric similarity.
Overfitting
A modelling error where an algorithm learns the training data and noise too closely, leading to poor generalisation on new test data.
Underfitting
A modelling error where an algorithm is too simple to capture the underlying pattern in the data, performing poorly on both training and test data.
Inference
The process of feeding new, unseen input features into a trained machine learning model to calculate a prediction.
Artificial Neural Network
A computational model formed of interconnected layers of nodes (input, hidden, and output) that adjust connection weights during training.
Deep Learning
A branch of machine learning that utilises artificial neural networks containing many hidden layers to learn complex representations.
Turing Test
A test of a machine's ability to exhibit intelligent behaviour indistinguishable from a human during blind conversational interaction.
Algorithmic Bias
Systematic and repeatable errors in an automated system that generate unfair or discriminatory outcomes against specific demographic groups.
Explainable AI (XAI)
Methods and techniques that make the internal logic, decisions, and predictions of machine learning systems understandable to human operators.
Heuristic
A practical problem-solving technique or shortcut that produces an acceptable approximate solution when standard algorithms are computationally infeasible.
Generative AI
A category of AI models that produce novel content—such as text, images, audio, or code—by learning the statistical patterns of large training datasets.
Training Data
The partition of a dataset used by an algorithm to discover patterns, adjust parameters, and learn rules.

Check yourself

  1. What is the primary difference between Supervised Learning and Unsupervised Learning?

    Supervised learning trains on labelled data where inputs are paired with known target answers. Unsupervised learning processes unlabelled data to discover natural groupings without pre-assigned answers.

  2. Name the five core components of a reinforcement learning system.

    The agent, the environment, the state, the action, and the reward (or penalty).

  3. Give one positive and one negative impact of AI on Irish society, each with an example.

    Positive: medical scan analysis helps radiologists detect tumours earlier in hospitals. Negative: automated screening tools trained on historical data can unfairly reject job or loan applicants from underrepresented groups.

  4. What is the difference between overfitting and underfitting?

    Overfitting occurs when a model learns training data and random noise too closely, performing poorly on new data. Underfitting occurs when a model is too simple to capture the underlying pattern, performing poorly on both training and test data.

  5. Why is machine learning unsuited to calculating standard VAT on retail goods?

    VAT calculations follow an exact, deterministic mathematical rule (e.g. price multiplied by 1.23) that requires 100% precision, which traditional code achieves without training data or prediction errors.

You've read the theory
Now turn it into exam marks.

Practise machine learning and artificial intelligence as questions and flashcards in Studytok, with explanations when you get stuck.

Continue for free →
  1. ✓
    Read the notes
    8 sections
  2. 2
    Test yourself
    Questions marked instantly
  3. 3
    Keep revising
    Flashcards and exam-style practice