Artificial Intelligence
Comprehensive exam revision notes for BCA-301N Unit 5 (AI Applications, Expert Systems & Natural Language Processing). Includes Section A (2M), Section B (5M), and Section C (15M) questions, answers, and diagrams.
Artificial Intelligence
AI Applications, Expert Systems & Natural Language Processing
Core Definitions & Key Concepts
What is an Expert System
An Expert System is a knowledge-intensive computer application that emulates the decision-making ability of a human specialist in a narrow, specific domain using domain knowledge and automated inference.
List the core components of an Expert System Architecture
- Knowledge Base: Stores domain rules and facts.
- Inference Engine: Applies logical reasoning to infer conclusions.
- Working Memory: Stores current session data.
- Explanation Facility: Justifies 'How' and 'Why' a decision was made.
- Knowledge Acquisition Module: Enters expert knowledge.
- User Interface: Facilitates user interaction.
What domain did MYCIN address and what reasoning technique did it pioneer
Developed at Stanford in the 1970s, MYCIN diagnosed blood-borne bacterial infections (bacteremia and meningitis). It pioneered backward chaining rule-based inference with Certainty Factors under uncertainty.
What was DENDRAL's historical significance
Developed in 1965 at Stanford, DENDRAL was the first successful knowledge-based expert system, deducing the chemical molecular structure of unknown organic compounds from mass spectrometer data.
What are the five classical phases of Natural Language Processing (NLP)
- Morphological/Lexical Analysis
- Syntactic Analysis (Parsing)
- Semantic Analysis
- Discourse Integration
- Pragmatic Analysis
Morphological Analysis in NLP
Morphological analysis breaks words down into their most fundamental meaningful units (morphemes), performing stemming, lemmatization, and affix stripping (e.g., unbelievable \to un- + believe + -able).
What is the role of a Grammar in Syntactic Parsing
A grammar (typically Context-Free Grammar, CFG) defines formal structural rules determining whether a sequence of tokens constitutes a syntactically valid sentence according to terminal and non-terminal symbols.
Supervised, Unsupervised, and Reinforcement Learning
- Supervised: Learns from labeled training data pairs (x, y).
- Unsupervised: Discovers hidden patterns/clusters in unlabeled data x.
- Reinforcement: Learns through trial-and-error by maximizing numerical scalar rewards from an environment.
What is the role of an Activation Function in Artificial Neural Networks
An activation function (e.g., ReLU, Sigmoid) introduces non-linearity into the network, allowing it to approximate arbitrary complex, non-linear mathematical mappings beyond simple linear separation.
The Turing Test Loebner Prize
The Loebner Prize was an annual competition launched in 1990 awarding prizes to chatbot programs considered most indistinguishable from humans based on standard Turing Test evaluation panels.
Conceptual & Architectural Analysis
The Architecture of an Expert System with a Detailed Block Diagram
+--------------------------------------------------------------+
| EXPERT SYSTEM SHELL |
| |
| +-------------+ +------------------+ |
| | Knowledge | | Explanation | |
| | Base (KB) | | Facility | |
| | Rules/Facts | | ("HOW" / "WHY") | |
| +-------------+ +------------------+ |
| ^ ^ |
| | | |
| v v |
| +------------------------------------------------------+ |
| | INFERENCE ENGINE | |
| | (Forward / Backward Chaining, Conflict Resolution) | |
| +------------------------------------------------------+ |
| ^ ^ |
| | | |
| v v |
| +-------------+ +------------------+ |
| | Working | | User Interface | |
| | Memory | <-----------------> | (Client/Web) | |
| +-------------+ +------------------+ |
+--------------------------------------------------------------+
^ ^
| |
[ Knowledge Engineer ] [ End User ]- Inference Engine: Decoupled from knowledge base, enabling system shells (e.g., CLIPS, JESS) to be repurposed across diverse domains.
Compare Forward Chaining vs Backward Chaining in Expert System Inference Engines
| Feature | Forward Chaining (Data-Driven) | Backward Chaining (Goal-Driven) |
|---|---|---|
| Starting Point | Working memory containing known symptoms/facts | Hypothesized disease or diagnosis goal |
| Rule Selection | Matches rule antecedents (IF conditions) | Matches rule consequents (THEN conclusions) |
| Prompting | Asks questions only after exhausting inferences | Asks targeted questions to verify specific sub-goals |
| Classic System | R1/XCON (Digital Equipment Corp computer config) | MYCIN (Medical diagnosis) |
| Cycle | Recognize-Act Cycle | Recursive Goal-Stack Resolution |
The 5 Classical Levels of Natural Language Processing
- Lexical/Morphological Analysis: Tokenizes text into words and punctuation; analyzes word stems, prefixes, and suffixes.
- Syntactic Analysis (Parsing): Verifies grammatical rules using Context-Free Grammars (CFGs) to produce hierarchical Parse Trees.
- Semantic Analysis: Assigns literal, context-free meaning to sentence components, verifying semantic type compatibility (e.g., rejecting 'Colorless green ideas sleep furiously').
- Discourse Integration: Resolves meaning across multi-sentence passages and coreference resolution (e.g., determining what 'it' refers to in 'The dog chased the ball because it was bouncing').
- Pragmatic Analysis: Interprets intended meaning in real-world communicative context (e.g., recognizing 'Can you pass the salt?' is a request, not a physical ability inquiry).
The Working of Perceptrons and the XOR Problem
A single-layer Perceptron computes y = f≤ft(\sum_{i=1}^n w_i x_i + b\right).
- XOR Problem (Minsky & Papert 1969): A single-layer perceptron can only learn linearly separable functions (AND, OR).
- The XOR truth table: (0,0)\to 0, (0,1)\to 1, (1,0)\to 1, (1,1)\to 0 cannot be separated by any single straight line in 2D space.
- Resolution: Overcome by Multi-Layer Perceptrons (MLPs) with non-linear activation functions trained via the Backpropagation algorithm.
Expert System Shells vs Native Development
An Expert System Shell is a pre-built expert system package containing the inference engine, user interface, explanation module, and working memory, but lacking domain knowledge.
- Benefit: Developers need only provide rules and facts without writing low-level parsing or inference code.
- Examples: CLIPS, JESS, Drools, EMYCIN (Empty MYCIN).
In-Depth Analysis & Implementation
Provide an In-Depth Analysis of the MYCIN Expert System Architecture, Certainty Factor Calculus, and Clinical Impact
Comprehensive Study of the MYCIN Expert System (Stanford 1976)
1. System Genesis and Purpose:
Developed by Edward Shortliffe at Stanford University, MYCIN was designed to assist physicians in prescribing antimicrobial therapy for patients with severe bacterial blood infections (bacteremia and meningitis).
2. Knowledge Representation in MYCIN:
MYCIN stored approximately 450 production rules in the following standard syntax:
1RULE 0352IF: 1) The gram stain of the organism is gramneg,3 2) The morphology of the organism is rod,4 3) The aerobicity of the organism is anaerobic5THEN: There is suggestive evidence (0.6) that the identity6 of the organism is Bacteroides.3. Certainty Factor (CF) Mathematical Calculus:
In clinical medicine, relationships are probabilistic rather than absolute. MYCIN developed Certainty Factor calculus:
- Measure of Belief ($MB(H, E)$): Increase in belief in hypothesis H given evidence E.
- Measure of Disbelief ($MD(H, E)$): Increase in disbelief in hypothesis H given evidence E.
- Certainty Factor Definition:
$CF(H, E) = MB(H, E) - MD(H, E) \quad where CF \in [-1.0, +1.0]$
Combination Rules:
- Conjunctive Antecedents (AND):
$CF(E_1 \wedge E_2) = \min(CF(E_1), CF(E_2))$
- Disjunctive Antecedents (OR):
$CF(E_1 \vee E_2) = \max(CF(E_1), CF(E_2))$
- Rule Application:
$CF(H) = CF(E) × CF_{rule}$
- Combining Multiple Independent Rules Supporting Same Hypothesis:
$CF_{comb}(CF_1, CF_2) = \begin{cases} CF_1 + CF_2 - (CF_1 \cdot CF_2) & if CF_1, CF_2 ≥ 0 \\ CF_1 + CF_2 + (CF_1 \cdot CF_2) & if CF_1, CF_2 < 0 \\ \frac{CF_1 + CF_2}{1 - \min(|CF_1|, |CF_2|)} & otherwise \end{cases}$
4. Clinical Impact and Legacy:
In blinded clinical trials, MYCIN's therapeutic recommendations achieved a 65% acceptability rating by independent infectious disease specialists, outperforming resident physicians and matching senior Stanford infectious disease faculty. It established the paradigm for explanation-based decision support systems.
Construct a Top-Down Context-Free Grammar (CFG) and Parse Tree for Natural Language Sentences
Natural Language Parsing Case Study
Sentence to Parse: 'The student wrote an intelligent program'
1. Context-Free Grammar Production Rules:
- Sentence Rule: S \to NP \; VP
- Noun Phrase Rules: NP \to Det \; N \mid Det \; Adj \; N
- Verb Phrase Rules: VP \to V \; NP
- Lexicon (Terminals):
- Det \to 'The' \mid 'an'
- N \to 'student' \mid 'program'
- Adj \to 'intelligent'
- V \to 'wrote'
2. Generated Hierarchical Parse Tree:
[ S ]
/ \
+---------+ +---------+
| |
[ NP ] [ VP ]
/ \ / \
[ Det ] [ N ] [ V ] [ NP ]
| | | / | \
'The' 'student' 'wrote' [Det][Adj] [N]
| | |
'an' 'intelligent' 'program'3. Syntactic Ambiguity:
When sentences possess multiple valid parse trees (e.g., 'I saw the man with a telescope'), semantic disambiguation and probabilistic context-free grammars (PCFGs) must be employed to select the most probable parse tree.
Implement a Complete Rule-Based Forward Chaining Expert System in Python
class Rule:
def __init__(self, antecedents, consequent, name=""):
self.antecedents = set(antecedents) # Pre-conditions
self.consequent = consequent # Inferred new fact
self.name = name
class ForwardChainingEngine:
def __init__(self):
self.rules = []
self.facts = set()
def add_rule(self, rule):
self.rules.append(rule)
def add_fact(self, fact):
self.facts.add(fact)
def run(self):
print(f"Initial Facts: {self.facts}")
fired = True
step = 1
while fired:
fired = False
for rule in self.rules:
# Check if all antecedents exist in known facts and consequent is not yet known
if rule.antecedents.issubset(self.facts) and rule.consequent not in self.facts:
self.facts.add(rule.consequent)
print(f"Step {step}: Fired Rule '{rule.name}' -> Added Fact: '{rule.consequent}'")
fired = True
step += 1
print(f"Final Established Facts Base: {self.facts}")
return self.facts
# Configure Expert System for Technical Troubleshooting
engine = ForwardChainingEngine()
engine.add_fact("screen_black")
engine.add_fact("power_light_blinking")
engine.add_rule(Rule(["screen_black", "power_light_blinking"], "power_supply_issue", "R1"))
engine.add_rule(Rule(["power_supply_issue"], "replace_power_cable", "R2"))
engine.add_rule(Rule(["replace_power_cable"], "contact_hardware_support", "R3"))
# Execute System
engine.run()Important Exam Points & Quick Revision
Examiner high-yield focus: Expert System Architecture with explanation module, MYCIN Certainty Factor math, and 5 stages of NLP.
100% left on this page — finishing it closes the gap for AI Applications, Expert Systems & Natural Language Processing.
AI Applications, Expert Systems & Natural Language Processing still counts as a weak topic until you finish this note and answer its questions.
Practise this unitTest Your Understanding
Now that you've read through these notes, practice unit MCQs to identify weak points and solidify your learning before exams.