Some problems need years of experience to solve. An expert system captures part of that experience so that it can be used again and again.

What is an Expert System

An expert system is a computer program that uses the knowledge of experts in a specific domain, and an inference procedure, to solve problems that normally need a human expert. Early examples are DENDRAL, which found the structure of chemical compounds, MYCIN, which diagnosed blood infections and advised on drugs, and PROSPECTOR, which helped to find mineral deposits. Today expert systems are used in medicine, fault diagnosis, loan approval, configuration of products and tax advice.

Definition: Expert system. A computer program that holds the knowledge of human experts in a narrow domain and reasons with it to give advice, diagnoses or decisions of expert quality.

Role of Knowledge

In a conventional program, the knowledge is mixed with the way the program works. In an expert system, the knowledge is kept apart from the reasoning. The knowledge base holds the domain facts and rules, and the inference engine is general and does not depend on the domain. The same engine can be used with a new knowledge base to make a new expert system. Power comes from the knowledge and not from the inference method, which is often called the knowledge principle. Expert knowledge includes facts, rules of thumb or heuristics from experience, and knowledge of how the problems are solved.

Architecture of an Expert System

The main parts are as follows. The knowledge base stores the facts and rules, often as IF-THEN rules. The inference engine selects and applies rules, using forward or backward chaining. The working memory, or global database, holds the facts of the present case. The user interface lets the user enter the facts and see the advice. The explanation facility tells the user how a conclusion was reached and why a question is asked, which builds trust. The knowledge acquisition facility helps the engineer to build and change the knowledge base. Some systems also have a learning component.

Characteristics and Limits

A good expert system gives advice of high quality, works fast, is reliable, can explain itself, and handles uncertain data. It does not tire and its advice is consistent. The limits are that it works only in a narrow domain, lacks common sense, cannot easily learn on its own, and breaks down at the edge of its knowledge. Building the knowledge base is slow and costly.

Table 3.1: Parts of an expert system

Part Function Used by
Knowledge base Stores rules and facts Inference engine
Inference engine Reasons with the knowledge System
Working memory Holds facts of the case Inference engine
User interface Dialogue with the user User
Explanation facility Gives how and why User
Knowledge acquisition Builds the knowledge base Knowledge engineer

Example 3.1: Expert system versus conventional program

Problem: State three differences between an expert system and a conventional program.

Solution:

  1. An expert system separates the knowledge from the inference, while a conventional program mixes them in code.
  2. An expert system works with symbols and heuristics and can give a good answer when data are incomplete, while a conventional program uses algorithms and needs complete data.
  3. An expert system can explain its conclusion, and a conventional program usually cannot.

Result: The differences are the separation of knowledge, the use of heuristics, and the ability to explain.

rules = [({"fever", "cough"}, "flu"), ({"flu"}, "rest")]
facts = {"fever", "cough"}
for cond, c in rules:
    if cond <= facts:
        facts.add(c)
print(sorted(facts))

Output

['cough', 'fever', 'flu', 'rest']

Common mistakes

  • Mixing the knowledge into the inference code, so that the system cannot be changed easily.
  • Expecting an expert system to work outside its narrow domain.
  • Leaving out the explanation facility, so that users do not trust the advice.

Key takeaways

  • An expert system holds expert knowledge and reasons with it.
  • The knowledge base is separate from the inference engine.
  • The parts include the working memory, user interface and explanation facility.
  • Examples are DENDRAL and MYCIN.

Practice questions

  1. Define an expert system.
  2. Name the main parts of an expert system.
  3. Why is the knowledge kept apart from the inference engine?

Answers to the practice questions

  1. A program that holds the knowledge of human experts in a narrow domain and reasons with it to give expert-quality advice.
  2. Knowledge base, inference engine, working memory, user interface, explanation facility and knowledge acquisition facility.
  3. So that the same engine can be reused with a new knowledge base and the knowledge can be changed easily.

Sources

  • Official BCA syllabus Artificial Intelligence and Expert Systems, course code 25BCA405DS02, Unit III