Artificial Intelligence
Computers simulating intelligent behaviour: expert systems that reason with rules, and machine learning that adapts itself.
WATCH IT EXPLAINED
EXPLORE IT IN 3D
The AI clinic
This clinic runs two AI systems: an expert system in a server cabinet, and a spam sorter that learns. Watch the rules fire for a patient, add a rule — then teach the sorter, and feed it bad data.
What AI is
AI makes a computer do things that would need intelligence if a person did them.
Exam:Artificial intelligence (AI) is a branch of computer science that deals with the simulation of intelligent behaviours by computers.
In simple words, AI makes a computer do things that would need intelligence if a person did them. For example:
- finding the fault in a machine
- recognising a face or a voice
- recommending a film you might like
- playing chess
Watch out:The computer does not think like a person. It follows data and rules. Some AI systems also change themselves from examples.
The IGCSE syllabus covers two kinds of AI system: expert systems and machine learning.
The characteristics of AI
An AI system has data, rules and the ability to reason; it can also learn, but it does not have to.
The syllabus describes the main characteristics of AI in three parts:
| Characteristic | What it means |
|---|---|
| a collection of data | facts, examples, readings |
| rules for using the data | IF ... THEN ... rules |
| the ability to reason | the system applies the rules to the data to reach new conclusions |
| it CAN include the ability to learn and adapt | machine learning does; not all AI does |
Notice the word "can". A system does not have to learn to be AI.
- An expert system on its own reasons with fixed rules. It does not learn, but it is still AI.
- A machine-learning system does learn.
Watch out:Never write that every AI system learns.
An expert system in four parts
An expert system gives advice like a human expert, using four parts that work together.
An expert system gives the kind of advice a human expert would give. It has four parts:
| Part | What it does |
|---|---|
| Knowledge base | holds the facts about the subject, collected from human experts |
| Rule base | holds IF … THEN rules for using those facts |
| Inference engine | applies the rules to the facts to reach a conclusion; it is the part that does the reasoning |
| Interface | asks the user questions and shows the conclusion |
Example:In the figure, answer the questions about a phone that will not charge. Each answer is a new fact. Any rule whose IF-part becomes true fires (is used), and the interface shows its advice.
How the inference engine reasons
The inference engine fires each rule whose IF-part is true, adds the result as a new fact, and repeats.
The inference engine looks for rules whose IF-part is true for the facts it has. Then:
- A rule fires. Its THEN-part becomes a new fact.
- That new fact can make another rule fire.
- The engine keeps going until nothing new follows.
- The interface shows the conclusion and the rules that led to it. So the user can see why the advice was given.
Example:In the figure, press the Chain preset: the light comes on, the screen stays black and the battery is old. R3 fires first, and its new fact makes R4 fire.
FACTS light, screen black, battery old
R3 fires IF light AND screen black
THEN fact: power arrives, no start
R4 fires IF power arrives, no start
AND battery old
THEN advise: replace the batteryBuilding, changing and using an expert system
Experts supply the facts and rules; to change the advice, a person edits a rule, and the engine stays the same.
Building it. People collect facts and rules from human experts. They enter them into the knowledge base and the rule base.
Changing it. To change the advice, a person adds or edits a rule. The inference engine stays the same.
Example:In the figure, say the phone gets hot, then switch on "An expert adds R7". New advice appears. Nothing else changes.
Using it. Expert systems are used, for example, for:
- medical diagnosis
- finding faults in cars and machines
Watch out:On its own, an expert system does not learn. A wrong rule gives the same wrong advice until a person changes it.
Machine learning: a program that changes itself
In machine learning, the program is not given rules; it changes itself to fit examples.
Exam:Machine learning is when a program has the ability to automatically adapt its own processes and/or data.
The program is not given the rules. It is given examples, called training data, and it changes itself to fit them.
The spam filter in the figure starts knowing nothing. Then it learns:
- A message marked spam: each word in it gains 1 point for every time it appears.
- A message marked not spam: each word loses 1 point in the same way.
To judge a new message, the filter adds up the points of its words:
| Total | Decision |
|---|---|
| more than 0 | spam |
| less than 0 | not spam |
| 0 | it cannot tell |
TEST Free phone offer
SCORES free +2, phone +1, offer 0
TOTAL +3, more than 0
DECISION spamLearning is only as good as the examples
A machine-learning program learns its examples' mistakes too, so its training data must be correct.
A machine-learning program learns whatever its training data shows, mistakes included.
Example:In the figure, the homework message has been marked spam by mistake. Train the filter, and it learns that "homework" means spam. It starts to hide real homework messages. Switch the mistake off to compare.
So a machine-learning system needs:
- a lot of correctly labelled data (examples already marked with the right answer)
- people who check its decisions
Machine learning is used, for example, in:
- spam filters
- weather forecasts that learn from past patterns
- robots that learn a better route
MISTAKE Homework is due now:
marked spam
LEARNS homework +1
TEST Homework help
TOTAL homework +1, help 0 = +1
DECISION spam, so a real message
is hiddenExpert system or machine learning?
Both are AI; the difference is where the rules come from and who changes them.
Both are AI, and both use data and rules to reach a decision. The difference is where the rules come from, and who changes them.
| Expert system | Machine learning | |
|---|---|---|
| Where do the rules come from? | human experts | the training data |
| Does it learn by itself? | no: the rules stay the same until a person changes them | yes: it adapts its own processes and data, with no person editing it |
| Examples | medical diagnosis, fault finding | spam filters, weather forecasts |
Watch out:An answer that says "a programmer changed the program" is not describing machine learning.
An expert system can also make use of machine learning, and then it learns as well.
Match each description to the term it defines.
PICK ONE, THEN PICK ITS GROUP
- empty
- empty
- empty
- empty
KEY TERMS
CHECK YOURSELF
1.What does machine learning add that an expert system on its own does not have?
2.Which part of an expert system applies the rules to the facts?
3.The syllabus says AI 'can include' the ability to learn and adapt. What does 'can' tell you?
4.Which part of an expert system asks the user questions and shows the advice?
5.A spam filter is trained with a real homework message marked spam by mistake. What happens?
6.An expert adds a new rule to an expert system's rule base. What must change in the inference engine?