AI and ML Foundations

Artificial Intelligence (AI) is the ability of a computer system to perform complex tasks without constant human guidance. These tasks may involve recognition, prediction, generation, planning, or decision-making.

An AI system may improve when more relevant data is collected and used to update it. More data alone does not guarantee improvement: the data must be suitable, prepared correctly, and used through training or tuning.

AI does not mean that a computer thinks or understands in the same way as a human. It means that the system can perform a task that would otherwise appear to require intelligent behaviour.

From Input to Useful Output

Every AI application has a specific task.

ExampleInputOutput
face recognitionimage or video frameidentity or verification result
voice recognitionaudio recordingtext or speaker identity
image classificationimagecategory label
spam filteringemail text and metadataspam or not spam
game playingcurrent game stateselected move
text generationprompt and contextgenerated text
image generationprompt or input imagegenerated image

A useful first question is:

What input is given, and what output should the system produce?

This prevents vague statements such as “the AI understands the image.” A more precise statement is “the system takes an image as input and predicts a category label.”

AI Systems Can Use Rules, ML, or Both

Not every AI system must use machine learning. Some systems may use search, logic, or hand-written rules. Many modern AI systems use ML because ML is useful when patterns are difficult to describe completely with fixed rules.

A real application can combine both approaches. For example, an ML model may predict whether a transaction is suspicious, while ordinary program rules decide whether to block it, request further verification, or record it for review.

Why Fixed Rules Can Be Difficult

Traditional rules work well when the procedure is clear and complete.

For example:

if age < 12:
    ticket_price = 8
else:
    ticket_price = 12

The categories and prices are known in advance.

Some tasks are harder to solve by listing every rule. Consider spam filtering:

if message contains phrase A:
    spam
elif message contains phrase B:
    spam
...

This approach is brittle because:

  • spammers can change wording;
  • legitimate messages may contain similar phrases;
  • useful clues may depend on combinations of features;
  • it is difficult to anticipate every future message.

Machine learning can instead learn patterns from many examples.

Machine Learning

Machine Learning (ML) is a technique used in AI in which a computer system learns patterns from data and uses those patterns to make predictions, classifications, or groupings.

A simple view is:

training data + learning algorithm -> model
model + new data -> prediction or grouping

The learning algorithm is the method used to find a pattern. The model is the fitted result that is later used on new data.

For example, a k-NN learning setup stores labelled examples and uses nearby examples to classify a new item. A k-means model contains cluster centres learned from unlabelled data.

Data, Features, and Labels

Suppose we want to classify emails as spam or not spam.

TermMeaningExample
data itemone record used in the taskone email
featurean input property supplied to the modelnumber of links
labelthe known answer for a supervised examplespam

An email can have several features:

message length
number of links
number of capital letters
whether certain terms appear

A feature is not automatically useful. Good features should carry information related to the prediction goal.

Traditional Programming Versus ML

AspectTraditional programmingMachine learning
Starting pointprogrammer writes explicit rulesprogrammer provides data and a learning method
Main resultprogram logicfitted model used by program logic
Suitable forclear rules and known procedurespattern-based tasks with relevant examples
Examplecalculate total price from items and tax rateclassify an email as spam or not spam

The difference is not that ML requires no programming. Traditional code is still used to:

  • gather and load data;
  • check and clean values;
  • select useful features;
  • create and fit a model;
  • test the model;
  • display or act on predictions.

A Worked Comparison

Traditional-programming task

Problem: decide whether a student qualifies for a discount.

Rule:

if student card is valid, apply the discount

The condition is known and can be coded directly.

Machine-learning task

Problem: predict whether a message is spam.

It may be difficult to write a complete rule for every message. Instead, labelled examples can be used to learn a classification pattern.

This does not mean ML is always the better choice. Use a simple rule when a simple rule solves the task accurately.

AI Does Not Mean Perfect

An AI system may fail because:

  • the training data is too small;
  • the examples do not represent future inputs;
  • labels are incorrect;
  • the data contains bias;
  • the chosen features are weak;
  • the model is unsuitable;
  • important conditions change over time;
  • evaluation is incomplete;
  • the system is used outside its intended context.

A confident-looking output can still be wrong. Predictions should therefore be evaluated rather than accepted automatically.

Responsible Data Checks

Before fitting, ask whether data collection respects consent and privacy, whether the sample represents intended users and future inputs, and whether labels are reliable. During evaluation, inspect errors across relevant groups rather than relying only on one overall score. After use begins, watch for feedback loops in which the model’s own decisions distort later training data. Human oversight and a clear intended-use boundary remain important. Detailed ethics belongs in Computing Ethics and Issues; this short section connects data quality to model quality.

Improving Performance

The syllabus definition notes that an AI system may improve as more data is collected. A careful description is:

More relevant and representative data may improve the system when the data is prepared and used to retrain or update the model.

Adding poor-quality or wrongly labelled examples can reduce performance instead.

Paper 1-Style Explanation

A strong definition should identify the role of data and the purpose of the learned pattern.

Machine learning is a technique used in AI in which a system learns patterns from data and uses the fitted model to make predictions or decisions on new data.

A weak answer is:

Machine learning means the computer becomes smart.

It is too vague because it does not mention data, learning patterns, a model, or what the model is used for.

Quick Check

  1. A program calculates GST from a fixed percentage. Is ML needed?
    Usually no. The rule is already clear.

  2. A system learns from labelled photographs to identify flowers. Is this ML?
    Yes. It learns a classification pattern from data.

  3. Does collecting more data automatically improve every AI system?
    No. The data must be relevant, correct, representative, prepared, and used to update the system.

  4. Is every AI system based on ML?
    No. ML is one technique used in AI.

Return to Artificial Intelligence and Machine Learning.