Course 6.3Lesson 2 of 3
An expert system asks questions, applies rules to the answers, and gives the advice a human expert would give. It has four parts: a knowledge base, a rule base, an inference engine and an interface. This lesson explains each part and follows a diagnosis from the first question to the conclusion.
Try the code and the simulations beside the lesson.
A farmer finds brown spots on her tomato plants. No plant expert lives nearby. On a computer, she answers a few questions: Are the spots on the old leaves or the new ones? Are there rings inside the spots? Then the program names the likely disease and the treatment. It behaves like the expert, so it is an expert system.
An expert system is one of the two kinds of AI system in the syllabus. It simulates the knowledge and the reasoning of a human expert in one subject. Expert systems are used to diagnose illnesses, find faults in cars and machines, identify plants and animals, and suggest where to search for minerals.
Knowledge base. This stores the facts about the subject, collected from human experts: the diseases, their signs, the treatments.
Rule base. This stores the rules for using those facts. Each rule has the form IF ... THEN ..., for example:
IF Spots = "rings" AND Leaves = "old"
THEN
Disease ← "early blight"
ENDIFInference engine. This is the part that reasons. It takes the user's answers, looks through the knowledge base, and applies the rules to reach a conclusion. It also chooses the next question to ask, based on the answers so far.
Interface. This is how the user and the system talk to each other. It asks the questions, takes in the answers, and shows the conclusion, often with how likely it is and the reasons.
One rule can use the conclusion of another. In the Python program below, the rule "too much water" fires first, and then a second rule uses it to conclude "root rot". This is the inference engine reasoning in two steps.
The program has all four parts. The knowledge base is the set facts. The rule base is the list rules. The interface is the list of questions and answers. The inference engine is the while loop that keeps applying rules until nothing new is found.
Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.
Every lesson is open to read. Enrolling also lets you:
Log in to join the discussion.
Loading…
This lesson is free to read. Enroll free to keep your place and take the tests.