Definition
Expert systems are programs that capture a human expert's knowledge as many if-then rules, and apply them with an inference engine. They were AI's first big commercial success, in the 1980s. Well-known examples are MYCIN for diagnosing infections and XCON for configuring computers.
In simple words
Sit with a top doctor for months, and write down all their rules of thumb. Now anyone can ask the program. It works well, until a case comes up that the rules never covered.
Why it matters
It shows both the power and the limit of hand-written knowledge. Companies still use rule engines for tax, eligibility and compliance, because rules are exact and easy to audit.
How it works
| Part | Does |
|---|---|
| Knowledge base | Stores the rules and facts |
| Inference engine | Applies the rules to reach conclusions |
| Explanation module | Shows which rules fired |
Why they stalled
- Getting knowledge out of experts was slow and costly.
- Thousands of rules became impossible to maintain.
- They were brittle: a case outside the rules gave poor answers.
- They couldn't learn from new data by themselves.
In code
RULES = [
({"fever", "cough"}, "flu"),
({"flu", "body pain"}, "rest and see a doctor"),
]
def infer(facts):
facts = set(facts)
changed = True
while changed:
changed = False
for needs, gives in RULES:
if needs <= facts and gives not in facts:
print("Rule fired:", needs, "->", gives)
facts.add(gives)
changed = True
return facts
result = infer(["fever", "cough", "body pain"])
print("Advice:", "rest and see a doctor" in result)Output
Rule fired: {'cough', 'fever'} -> flu
Rule fired: {'body pain', 'flu'} -> rest and see a doctor
Advice: TrueCommon mistakes
- Writing off rules because they're old. They're right for clear, stable logic.
- Expecting a rule system to handle cases it has no rules for.
Check yourself
Summary
- Experts' knowledge becomes if-then rules.
- Clear and explainable, but brittle and costly.
- Rule engines are still used today.
Finished reading?
Sources: Russell & Norvig, Artificial Intelligence: A Modern Approach, ch. 1