Artificial Intelligence Notes
Artificial Intelligence Notes
UNIT 1...................................................................................................................................... 7
Introduction to Artificial Intelligence (AI)-......................................................................7
Key Features of AI:.......................................................................................................7
Categories of AI:...........................................................................................................7
Applications of AI:.........................................................................................................7
Benefits of AI:............................................................................................................... 7
Challenges:.................................................................................................................. 7
Emulation of Human Cognitive Processes in AI:.......................................................... 9
Key Cognitive Processes Emulated by AI:................................................................... 9
Knowledge Search Trade-off in AI:...............................................................................10
Example:.................................................................................................................... 10
The Trade-off:............................................................................................................. 10
Stored Knowledge in AI-................................................................................................ 11
Types of Stored Knowledge:.......................................................................................11
How Stored Knowledge is Used:................................................................................ 11
Benefits:......................................................................................................................11
Semantic nets-................................................................................................................12
Key Components:....................................................................................................... 12
Example:.................................................................................................................... 12
How Semantic Networks are Used in AI:................................................................... 12
Benefits:..................................................................................................................... 13
Challenges:................................................................................................................ 13
Abstract View of Modeling in AI-.................................................................................. 14
Types of Models in AI:................................................................................................ 14
Modeling Process:...................................................................................................... 14
Example of Modeling:................................................................................................. 14
In Simple Terms:.........................................................................................................14
Elementary Knowledge in AI:........................................................................................15
Computational Logic in AI:............................................................................................17
Key Concepts in Computational Logic:...................................................................... 17
Why Computational Logic is Important in AI:............................................................. 18
Logical Connectives:..................................................................................................... 19
Following is the summarized table for Propositional Logic Connectives:...................19
Truth Table:..................................................................................................................... 19
Predicate Logic:............................................................................................................. 21
Key Components of Predicate Logic:......................................................................... 21
Knowledge Organization and Manipulation in AI........................................................22
1. Knowledge Organization:....................................................................................... 22
Key Methods of Knowledge Organization:........................................................... 22
1. Knowledge Representation:................................................................................... 22
2. Knowledge Manipulation:....................................................................................... 23
Key Methods of Knowledge Manipulation:........................................................... 23
2
Knowledge Acquisition..................................................................................................25
Key Concepts in Knowledge Acquisition:................................................................... 25
Summary:................................................................................................................... 26
UNIT 2.................................................................................................................................... 27
LISP in Artificial Intelligence (AI)-.................................................................................27
Why LISP is Suitable for AI........................................................................................ 27
Applications of LISP in AI........................................................................................... 28
Syntax of LISP................................................................................................................ 29
Basic Syntax Rules:..............................................................................................29
Distinction Between LISP and Prolog.........................................................................31
1. Programming Paradigm......................................................................................... 31
2. Syntax.................................................................................................................... 31
3. Problem-Solving Approach.....................................................................................31
4. Core Applications................................................................................................... 31
5. Execution Model..................................................................................................... 32
6. Strengths................................................................................................................ 32
7. Weaknesses........................................................................................................... 32
LISP Input/Output (I/O)...................................................................................................34
1. Input Operations............................................................................................... 34
2. Output Operations............................................................................................ 34
Local Variables in LISP.................................................................................................. 34
1. let for Local Variables....................................................................................... 34
Interaction and Recursion in LISP................................................................................35
1. Interaction in LISP.................................................................................................. 35
Example: Asking for the User's Name........................................................................35
Explanation:................................................................................................................35
Recursive Function Structure:.............................................................................. 36
Example: Factorial Function................................................................................. 36
Property list and array alternative languages-............................................................ 37
1. Property List Alternatives....................................................................................... 37
Alternatives in Other Languages:......................................................................... 37
2. Array Alternatives................................................................................................... 37
Alternatives in Other Languages:......................................................................... 37
Formalized Logic and Properties of Well-Formed Formulae (WFFs)- Or WFRS (Well
Formed Rule System).................................................................................................... 39
1. What is a Well-Formed Formula (WFF)?................................................................39
Examples of WFFs:.............................................................................................. 39
2. Rules for Constructing WFFs................................................................................. 39
Symbolic Representation in WFFs............................................................................... 39
Components of WFFs:..........................................................................................39
Non-Deductive Inference Methods-.............................................................................. 41
Types of Non-Deductive Inference Methods.............................................................. 41
1. Inductive Reasoning......................................................................................... 41
2. Abductive Reasoning........................................................................................41
3
3. Analogical Reasoning.......................................................................................41
4. Statistical Reasoning........................................................................................ 42
5. Heuristic Reasoning......................................................................................... 42
6. Fuzzy Logic...................................................................................................... 42
7. Default Reasoning............................................................................................ 42
8. Commonsense Reasoning............................................................................... 43
Comparison of Deductive and Non-Deductive Methods............................................ 43
Conclusion..................................................................................................................43
Inconsistencies and Uncertainties in Truth Maintenance Systems (TMS)-.............. 44
Key Concepts............................................................................................................. 44
1. Inconsistencies in TMS.....................................................................................44
Example of Inconsistency:....................................................................................44
2. Uncertainties in TMS........................................................................................ 44
Example of Uncertainty:....................................................................................... 44
How TMS Handles Inconsistencies and Uncertainties...............................................44
1. Assumption-Based Truth Maintenance System (ATMS).................................. 45
2. Justification-Based Truth Maintenance System (JTMS)...................................45
3. Probabilistic TMS (PTMS)................................................................................ 45
Default Reasoning and Closed World Assumption-................................................... 46
1. Default Reasoning..................................................................................................46
Definition:..............................................................................................................46
Key Features:....................................................................................................... 46
Example:...............................................................................................................46
Applications:......................................................................................................... 46
Challenges:...........................................................................................................46
2. Closed World Assumption (CWA).......................................................................... 47
Definition:..............................................................................................................47
Key Features:....................................................................................................... 47
Example:...............................................................................................................47
Applications:......................................................................................................... 47
Challenges:...........................................................................................................47
Comparison Between Default Reasoning and CWA.................................................. 48
Model and Temporary Logic in Artificial Intelligence-................................................ 49
In artificial intelligence (AI) and knowledge representation, models and temporary
logic (also known as temporal logic) are two essential concepts used to reason about
the world and handle changes or states over time.....................................................49
Model..........................................................................................................................49
Key Features of a Model:..................................................................................... 49
Types of Models in AI:.......................................................................................... 49
Applications:......................................................................................................... 49
Temporal Logic........................................................................................................... 49
Key Features of Temporal Logic:..........................................................................50
Temporal Operators:.............................................................................................50
UNIT 3.................................................................................................................................... 51
4
Fuzzy Logic-....................................................................................................................51
Fuzzy Logic Operations-................................................................................................51
Probabilistic Reasoning in AI-...................................................................................... 51
Key Concepts of Probabilistic Reasoning.................................................................. 51
Features of Probabilistic Reasoning...........................................................................51
Applications of Probabilistic Reasoning..................................................................... 51
Advantages of Probabilistic Reasoning......................................................................52
Disadvantages of Probabilistic Reasoning................................................................. 52
Conclusion..................................................................................................................52
Bayesian Probabilistic Inference-.................................................................................53
Steps in Bayesian Probabilistic Inference.................................................................. 53
Applications of Bayesian Inference............................................................................ 53
Advantages of Bayesian Inference.............................................................................54
Disadvantages............................................................................................................54
Conclusion..................................................................................................................54
Dempster-Shafer Theory (DST)-....................................................................................55
Advantages of Dempster-Shafer Theory....................................................................55
Disadvantages of Dempster-Shafer Theory............................................................... 55
Applications of Dempster-Shafer Theory................................................................... 55
Dempster-Shafer Theory (DST), word representation-............................................... 57
Ad-hoc Methods in Artificial Intelligence.....................................................................58
Example..................................................................................................................... 58
Advantages of Ad-hoc Methods................................................................................. 58
Disadvantages of Ad-hoc Methods............................................................................ 58
Conclusion..................................................................................................................59
Structured Knowledge: Graphs-................................................................................... 60
What is a Graph?....................................................................................................... 60
Types of Graphs Used in AI....................................................................................... 60
Uses of Graphs in AI.................................................................................................. 61
Advantages of Using Graphs in AI............................................................................. 61
Challenges in Graph Representation......................................................................... 62
Conclusion..................................................................................................................62
Frames and Related Structures-................................................................................... 63
What is a Frame?....................................................................................................... 63
Key Concepts of Frames............................................................................................ 63
Advantages of Using Frames in AI.............................................................................64
Applications of Frames in AI.......................................................................................64
Conclusion..................................................................................................................64
Object-Oriented Representations: Object Classes-....................................................65
What is a Class in Object-Oriented Representations?............................................... 65
Object Class Structure............................................................................................... 65
How Object Classes are Used in AI........................................................................... 66
Advantages of Object-Oriented Representation in AI................................................ 66
Conclusion..................................................................................................................67
5
1. RETE Network:.................................................................................................82
2. Input Facts:.......................................................................................................83
3. Partial Matches:................................................................................................83
4. Activation:......................................................................................................... 83
5. Efficiency:......................................................................................................... 83
Advantages of RETE.................................................................................................. 83
Disadvantages of RETE............................................................................................. 83
Knowledge Organization: Indexing and Retrieval Techniques..................................84
1. Indexing Techniques...............................................................................................84
Key Methods of Indexing:..................................................................................... 84
2. Retrieval Techniques.............................................................................................. 84
Key Methods of Retrieval:.................................................................................... 84
Applications of Indexing and Retrieval....................................................................... 85
Integration of Knowledge in Memory Organization System...................................... 86
Key Concepts of Knowledge Integration.................................................................... 86
Methods for Knowledge Integration............................................................................86
Memory Organization Strategies................................................................................ 87
Challenges in Knowledge Integration.........................................................................87
Perception in Artificial Intelligence.............................................................................. 88
Key Components of Perception in AI......................................................................... 88
Types of Perception in AI........................................................................................... 88
Applications of Perception in AI..................................................................................88
Example of AI Perception........................................................................................... 89
Communication and Expert Systems......................................................................... 90
Key Components of Communication in Expert Systems............................................90
Importance of Communication in Expert Systems..................................................... 90
Communication and Expert Systems...........................................................................92
Key Components of Communication in Expert Systems............................................92
Importance of Communication in Expert Systems..................................................... 92
Challenges in Communication for Expert Systems.................................................... 93
Linguistics...................................................................................................................... 94
Main Parts of Linguistics............................................................................................ 94
Why Linguistics is Important.......................................................................................94
Process for Agent Specification, Simulation, and Implementation...........................96
1. Agent Specification.................................................................................................96
2. Agent Simulation.................................................................................................... 96
3. Agent Implementation............................................................................................ 97
Summary of the Process............................................................................................ 97
Semantic Analysis and Representation Structures.................................................... 98
1. Semantic Analysis.................................................................................................. 98
2. Representation Structures......................................................................................98
Summary.................................................................................................................... 99
Natural Language Generation (NLG) and Systems...................................................100
What is NLG?........................................................................................................... 100
7
UNIT 1
1. Learning: AI systems can improve over time through machine learning (ML), where
they learn patterns from data.
2. Reasoning: AI can make decisions or predictions based on logical rules or learned
patterns.
3. Adaptation: It adjusts to new inputs and situations dynamically.
4. Automation: AI performs repetitive or complex tasks without constant human
intervention.
Categories of AI:
1. Narrow AI: Specialized systems that perform a single task (e.g., virtual assistants
like Amazon Alexa, Siri).
2. General AI: A theoretical form of AI capable of performing any intellectual task that
humans can do.
3. Superintelligent AI: Hypothetical AI that surpasses human intelligence in virtually
every field.
Applications of AI:
Benefits of AI:
Challenges:
1. Perception: Like how humans see, hear, and recognize patterns, AI uses sensors
(like cameras and microphones) to understand the environment (e.g., object
recognition in images).
2. Learning: Similar to how humans learn from experience, AI can improve its
performance by analyzing data (using machine learning algorithms). For example,
AI can get better at recognizing faces after seeing many examples.
3. Reasoning and Problem-Solving: AI can solve problems or make decisions based
on rules and patterns. It's similar to how humans reason through a problem, such as
making decisions based on available information.
4. Memory: Like how we store and retrieve past experiences, AI systems can store
data and use it to make decisions or predictions.
5. Language Understanding: Just as humans understand and generate speech, AI
uses natural language processing (NLP) to understand and communicate with
humans in natural language (e.g., Siri or Google Assistant).
In summary, AI tries to emulate how humans think and act by creating systems that can
perceive, learn, reason, and make decisions, much like our own cognitive abilities.
10
1. Search Space: The space of possible solutions or decisions an AI can explore. For
example, in a chess game, the search space is all the possible moves from any given
position.
2. Efficiency vs. Completeness: When an AI searches for a solution, it can either:
○ Be exhaustive (searching through all possible options for the best solution),
but this can be time-consuming and computationally expensive.
○ Use shortcuts (like heuristics, which are rules of thumb) to speed up the
search, but this may miss the best solution.
3. Trade-off: If you use too much knowledge and search too deeply (exhaustive
search), it can be slow and computationally expensive. If you simplify the search
(using less knowledge or heuristics), the solution may not be the best one.
Example:
● Chess AI: A chess-playing AI could search every possible move (exhaustive) to find
the best one, but this would take a long time. Alternatively, it could use heuristics
(rules like "control the center of the board") to make decisions more quickly, but it
might not always find the best possible move.
The Trade-off:
● More Knowledge = Slower Search: The more knowledge (or options) the AI has to
consider, the longer it takes to process and find the optimal solution.
● Less Knowledge = Faster Search, Possible Suboptimal Solution: Reducing the
knowledge or the depth of search speeds up the process, but it might lead to a
less-than-optimal decision.
In practice, AI systems aim to strike a balance, where they use enough knowledge and
search depth to make good decisions without overwhelming computational resources.
11
1. Facts and Data: Raw data that the AI system has gathered, such as numbers,
measurements, or observations. For example, a recommendation system for movies
might store user preferences and ratings.
2. Rules and Heuristics: Predefined logic or guidelines used by AI to make decisions.
For instance, an expert system might store rules like "If the weather is rainy, wear a
raincoat."
3. Knowledge Base: A collection of information that the AI system uses to perform
tasks. It can be structured (like a database) or unstructured (like text). For example,
medical diagnosis systems might store a vast knowledge base of symptoms,
diseases, and treatments.
4. Memory and Experience: AI systems can learn and store experiences from
interactions, improving their performance over time. For example, machine learning
models store patterns and insights derived from historical data to predict future
outcomes.
5. Representations: AI stores knowledge in various representations, such as semantic
networks (a web of interconnected concepts), decision trees (used for classification
or decision-making), or neural networks (used to recognize patterns from data).
1. Declarative Knowledge: Information about "what" something is. For example, "The
Eiffel Tower is in Paris."
2. Procedural Knowledge: Information about "how" to do something. For example, "To
solve a quadratic equation, apply the quadratic formula."
Benefits:
Semantic nets-
Semantic Networks | Artificial Intelligence | Components | Knowledge Representation -…
Key Components:
Example:
In this example:
● The node "Dog" is connected to "Animal" via the edge "is a", indicating that a dog is a
type of animal.
● "Dog" is connected to "Tail" via the edge "has", showing that dogs have tails.
● "Dog" is connected to "Bark" via the edge "can", showing that dogs can bark.
Benefits:
Challenges:
● Scalability: As the knowledge base grows, managing large and complex networks
becomes difficult.
● Ambiguity: The meaning of certain relationships can be ambiguous, and
representing complex, subtle connections might require additional structures or
methods.
14
Modeling Process:
1. Problem Definition: Define what you want the model to solve or predict.
2. Data Collection: Gather relevant data for training and testing the model.
3. Model Design: Decide which type of model to use and how to represent the data.
4. Training and Validation: Train the model on data, validate its performance, and
adjust as necessary.
5. Deployment: Use the model in real-world scenarios to make predictions or
decisions.
Example of Modeling:
● Self-Driving Car: The AI model might represent the car’s environment (road,
pedestrians, other vehicles) using sensors and cameras. It learns through experience
(data) and optimizes driving behavior to avoid collisions and follow traffic rules.
In Simple Terms:
● Modeling in AI is like building a "map" of the world or problem you want the AI to
understand. You simplify and abstract the complex reality into something the system
can work with, and the AI uses this model to make decisions or predictions.
15
Elementary knowledge refers to the basic, fundamental concepts or facts that are essential
for understanding more complex ideas in AI. It forms the building blocks for more advanced
topics and helps in creating simple AI systems.
Data is the raw input for AI systems. It can come in many forms such as numbers,
images, text, or sounds. AI uses data to learn and make decisions.
Example: Data about customer purchases helps AI predict what products might interest
other customers.
2. Algorithms:
Machine Learning is a type of AI where machines learn from data without being explicitly
programmed. They find patterns or regularities in data and use them to make predictions or
decisions.
Example: A spam filter learns to recognize spam emails by analyzing data from previously
marked emails.
4. Model:
5. Neural Networks:
Neural Networks are a type of machine learning model inspired by how the human brain
works. They are particularly good at recognizing patterns in large amounts of data, like
images or speech.
Example: Neural networks help recognize handwritten digits in postal codes or classify
images as "cats" or "dogs."
6. Supervised Learning:
16
In supervised learning, AI learns from labeled data. It is provided with input-output pairs
and learns the mapping between them.
Example: A facial recognition system is trained on images with labels like "John" or
"Jane."
7. Unsupervised Learning:
Unsupervised learning involves learning patterns from data without labeled output. The AI
system tries to find hidden structures in the data.
Example: A clustering algorithm groups customers into similar categories based on
purchasing behavior.
1. Propositional Logic:
○ In propositional logic, statements (propositions) can be either true or false.
The goal is to combine and manipulate these propositions using logical
operators like AND, OR, NOT, etc.
○ Example:
■ "It is raining" (True) AND "I have an umbrella" (True) → "I am
prepared" (True).
○ Operators:
■ AND ( ∧ ): Both conditions must be true for the whole expression to
be true.
■ OR ( ∨ ): At least one condition must be true for the whole expression
to be true.
■ NOT ( ¬ ): Reverses the truth value of a condition.
2. Predicate Logic:
○ Predicate logic extends propositional logic by dealing with predicates,
variables, and quantifiers (like "for all" or "there exists"). It allows for more
complex statements about objects and their properties.
○ Example: "All humans are mortal." In logic, this might be written as:
■ ∀x (Human(x) → Mortal(x)), meaning "For all x, if x is a human, then x
is mortal."
○ This type of logic is useful for representing real-world knowledge and
reasoning about entities, relationships, and conditions.
3. Logical Inference:
○ Inference is the process of deriving new knowledge or conclusions from
known facts using logical rules.
○ Example:
■ Fact 1: "All cars have wheels."
■ Fact 2: "My car is a vehicle."
Logical Connectives:
Logical connectives are used to connect two simpler propositions or representing a sentence
logically. We can create compound propositions with the help of logical connectives. There
are mainly five connectives, which are given as follows:
Truth Table:
In propositional logic, we need to know the truth values of propositions in all possible
scenarios. We can combine all the possible combination with logical connectives, and the
representation of these combinations in a tabular format is called Truth table. Following are
the truth table for all logical connectives:
20
21
Predicate Logic:
Predicate Logic (also known as First-Order Logic) is an extension of propositional logic
that allows us to express statements involving objects, their properties, and relationships
between them. While propositional logic is limited to simple true/false propositions, predicate
logic provides a more powerful framework for expressing more complex logical statements.
1. Predicates:
○ A predicate is a function that takes one or more arguments and returns a
truth value (true or false).
○ Predicates represent properties or relations between objects.
○ Example: "isTall(x)" could be a predicate that says whether an object x is tall.
2. Variables:
○ Variables (like x, y, z) are used to represent objects or individuals in a
domain.
○ They are placeholders that can be replaced by specific values or entities.
3. Constants:
○ A constant represents a specific, unchanging object or entity in the domain.
○ Example: "John" could be a constant representing a specific person.
4. Quantifiers:
○ Universal Quantifier (∀): Indicates that a statement is true for all possible
values of a variable.
■ Example: ∀x (Human(x) → Mortal(x)) means "All humans are
mortal."
○ Existential Quantifier (∃): Indicates that there exists at least one value of a
variable for which the statement is true.
■ Example: ∃x (Cat(x) ∧ LovesFish(x)) means "There exists at least
one cat that loves fish."
5. Logical Connectives:
○ Just like propositional logic, predicate logic uses logical connectives such as
AND (∧), OR (∨), NOT (¬), IMPLIES (→), and IF AND ONLY IF (↔) to
combine statements and form complex expressions.
22
1. Knowledge Organization:
1. Knowledge Representation:
○ Knowledge representation is the process of encoding real-world knowledge
in a form that an AI system can use. It involves choosing the right structure to
represent facts, relationships, and entities.
○ Common methods of knowledge representation include:
■ Logic-based Representation: Using propositional and predicate logic
to represent knowledge, which allows formal reasoning.
■ Semantic Networks: Using a graph structure where nodes represent
concepts, and edges represent relationships between them.
■ Frames: Organizing knowledge into structured objects that represent
concepts and their associated properties.
■ Ontologies: A formal representation of knowledge that defines
concepts and the relationships between them in a specific domain.
■ Scripts and Schemas: Representing common sequences of events
or actions (like a "going to a restaurant" script).
2. Taxonomy:
○ A taxonomy is a hierarchical classification system that groups knowledge
into categories based on shared characteristics.
○ Example: In a biological classification system, animals might be categorized
into mammals, birds, fish, etc.
3. Hierarchical Models:
○ In this approach, knowledge is organized in layers of increasing abstraction.
For example, a hierarchy in AI might organize concepts from specific
instances to general categories.
○ Example: "Animal → Mammal → Dog → Golden Retriever."
4. Conceptual Graphs:
○ These are graphical representations of knowledge that capture concepts and
their relationships in a visual format.
○ They allow AI systems to represent and reason about concepts (such as
"person", "action", or "event") and their attributes or relations (like "John runs"
or "Mary loves pizza").
5. Associative Networks:
23
2. Knowledge Manipulation:
Knowledge manipulation refers to the processes by which AI systems use, process, and
infer new knowledge from the organized data. This includes reasoning, problem-solving,
learning, and decision-making.
1. Reasoning:
○ Reasoning is the process by which an AI system draws conclusions from
existing knowledge.
○ Types of reasoning:
■ Deductive Reasoning: From general facts to specific conclusions.
(E.g., "All humans are mortal, Socrates is human, therefore Socrates
is mortal.")
■ Inductive Reasoning: From specific facts to general conclusions.
(E.g., "I have seen 10 white swans, therefore all swans must be
white.")
■ Abductive Reasoning: Involves finding the most likely explanation for
a set of observations. (E.g., "The ground is wet, the most likely
explanation is that it rained.")
○ Inference Engines are used to perform reasoning in AI systems, helping the
system draw conclusions based on a knowledge base.
2. Problem-Solving:
○ AI systems use organized knowledge to solve problems. This process
involves breaking down a problem into smaller components and using
available knowledge to find solutions.
○ Techniques include:
■ Search Algorithms: Such as depth-first search, breadth-first search,
and A* search, which explore possible solutions systematically.
■ Heuristic Methods: Using "rules of thumb" to make decisions based
on experience or patterns.
3. Learning:
○ Machine Learning (ML): AI systems learn patterns from data and improve
over time without explicit programming. This involves manipulating large
datasets to extract useful knowledge and update models.
○ Types of Learning:
■ Supervised Learning: The system is trained on labeled data and
learns to map input to output.
■ Unsupervised Learning: The system learns patterns from unlabeled
data (e.g., clustering or dimensionality reduction).
■ Reinforcement Learning: The system learns by interacting with an
environment and receiving feedback in the form of rewards or
penalties.
24
4. Decision-Making:
○ AI systems use knowledge to make decisions. This could involve reasoning
about potential outcomes, weighing risks, and choosing the best course of
action.
○ Common decision-making models include:
■ Decision Trees: A tree-like structure where each node represents a
decision and branches represent possible outcomes.
■ Markov Decision Processes (MDPs): A mathematical model used
for decision-making in environments with uncertainty and
randomness.
■ Game Theory: A framework for understanding strategic
decision-making, particularly in multi-agent environments.
5. Natural Language Processing (NLP):
○ AI systems use knowledge manipulation to understand, interpret, and
generate human language.
○ NLP tasks like parsing, information extraction, and machine translation
involve organizing knowledge about language structure and meaning and
manipulating it to achieve desired outcomes.
6. Expert Systems:
○ Expert systems are AI systems that manipulate organized knowledge to
mimic the decision-making ability of a human expert. They rely on a
knowledge base of facts and rules to make inferences and solve specific
problems in fields like medicine, engineering, and finance.
25
Knowledge Acquisition
Knowledge Acquisition in AI refers to the process of gathering and collecting knowledge
from various sources to create or enhance an AI system's knowledge base. It involves
obtaining both explicit knowledge (e.g., facts, rules, and data) and implicit knowledge
(e.g., experience, intuition) to make AI systems capable of reasoning, decision-making, and
problem-solving.
1. Sources of Knowledge:
○ Human Experts: Knowledge can be obtained from people who are experts in
a particular domain. This might involve interviewing experts, reading
literature, or observing their decisions.
○ Existing Databases and Knowledge Bases: Many AI systems acquire
knowledge from existing structured data sources, such as relational
databases, ontologies, or knowledge graphs.
○ Documents and Text: AI can extract knowledge from texts, articles, and
other documents using Natural Language Processing (NLP) techniques.
○ Experience: Knowledge can be gathered through interaction with the
environment (e.g., reinforcement learning or expert systems).
○ Sensors and Real-World Data: AI systems can acquire knowledge from data
captured through sensors or online data sources (such as weather data or IoT
devices).
2. Methods of Knowledge Acquisition: Knowledge acquisition can be performed
through various techniques. These techniques can be broadly classified into manual
methods, automatic methods, and semi-automatic methods.
○ Manual Knowledge Acquisition:
■ Expert Interviews: Directly interviewing domain experts to gather
facts, rules, and heuristics.
■ Observation: Observing experts or practitioners to capture implicit
knowledge based on experience.
■ Surveys and Questionnaires: Asking targeted questions to experts
or users to gather information.
■ Knowledge Engineering: Manually designing the knowledge base,
sometimes with the help of knowledge engineers who understand both
the problem domain and AI system design.
○ Automatic Knowledge Acquisition:
■ Machine Learning: AI systems can learn from data using algorithms
like decision trees, neural networks, and clustering techniques. This is
an example of automatic knowledge acquisition from large datasets.
■ Data Mining: AI systems can automatically extract useful knowledge
from large datasets using techniques like classification, regression,
association rules, or clustering.
■ Natural Language Processing (NLP): AI can analyze and extract
useful information from textual data, such as extracting entities and
relationships from unstructured text (e.g., articles, social media posts).
26
Summary:
UNIT 2
LISP in Artificial Intelligence (AI)-
LISP (short for LISt Processing) was specifically designed for AI research by John
McCarthy in 1958. It quickly became the dominant programming language for AI because of
its flexibility, symbolic reasoning capabilities, and support for recursive algorithms.
Many of the foundational AI systems and research projects were developed using LISP.
1. Symbolic Processing:
○ AI often deals with symbols, rather than numbers, to represent knowledge,
logic, and reasoning.
○ LISP excels at manipulating symbolic data, such as symbols and
expressions, making it ideal for tasks like natural language processing,
theorem proving, and expert systems.
2. Recursive Functions:
○ Many AI problems, such as tree traversal or search algorithms, are naturally
recursive.
○ LISP’s syntax and structure make it easy to implement and debug recursive
algorithms.
3. Dynamic Typing:
○ In AI, systems often deal with diverse types of data.
○ LISP’s dynamic typing allows variables to hold any type of data, adapting to
changing requirements in AI models.
4. Flexible Syntax:
○ LISP’s syntax is simple and uniform, allowing programs to manipulate their
own code.
○ This makes it easy to create AI programs that modify themselves or learn new
rules dynamically.
5. Garbage Collection:
○ Automatic memory management enables AI programs to handle large
amounts of dynamically generated data without worrying about memory
allocation or deallocation.
6. First-Class Functions:
○ Functions in LISP are treated as first-class citizens, meaning they can be
passed as arguments, returned as values, or stored in data structures.
○ This is crucial for AI tasks, such as defining and applying rules dynamically.
7. Prototyping and Experimentation:
○ LISP’s interactive environment (REPL - Read-Eval-Print Loop) supports rapid
prototyping and testing, which is essential for AI researchers to experiment
with new algorithms and ideas.
28
Applications of LISP in AI
1. Expert Systems:
○ Early AI expert systems, like MYCIN (a medical diagnostic system), were built
using LISP.
○ These systems encoded knowledge in the form of rules and performed
reasoning using symbolic data.
2. Natural Language Processing (NLP):
○ LISP was used in early NLP systems for tasks like parsing, sentence
generation, and machine translation.
○ Its symbolic processing capabilities made it well-suited for representing and
manipulating language constructs.
3. Theorem Proving:
○ AI systems that solve logical proofs or perform formal reasoning were
implemented in LISP.
○ For example, the Logic Theorist, one of the first AI programs, used symbolic
reasoning to prove mathematical theorems.
4. Robotics:
○ Early robotics systems used LISP for high-level reasoning, such as path
planning, rule-based decision-making, and symbolic representation of the
environment.
5. Machine Learning:
○ Although less common now, LISP was used for early implementations of
learning algorithms because of its flexibility and support for recursive
functions.
6. Knowledge Representation:
○ AI systems often need to represent and manipulate knowledge, such as
ontologies, taxonomies, and knowledge graphs.
○ LISP’s ability to define symbolic relationships and rules made it ideal for these
tasks.
29
Syntax of LISP
LISP has a simple and unique syntax based on S-expressions (symbolic expressions).
Everything in LISP, from data structures to code, is represented in parentheses.
1. Parentheses:
○ LISP uses fully parenthesized prefix notation.
○ Example: (+ 1 2) means "add 1 and 2."
2. Atoms:
○ Atoms are the simplest elements in LISP and include:
■ Numbers: 42, 3.14
■ Strings: "hello"
■ Symbols: x, my-var
3. Lists:
○ A list is a sequence of elements (atoms or other lists) enclosed in
parentheses.
○ Example: (1 2 3) or (x y z)
4. Functions:
○ Functions are written in the form:
Relational Operators:
These operators compare two numbers and return T (true) or NIL (false).
Equal:
Example:
(= 5 5) ; Result: T
Not Equal:
Example:
(/= 5 3) ; Result: T
Greater Than:
Example:
30
(> 7 3) ; Result: T
Less Than:
Example:
(< 3 7) ; Result: T
Example:
(>= 5 5) ; Result: T
Example:
(<= 4 6) ; Result: T
31
LISP and Prolog are both high-level programming languages commonly used in Artificial
Intelligence (AI). However, they differ significantly in terms of paradigm, syntax, and their
approach to solving problems. Here's a comparison:
1. Programming Paradigm
● LISP:
○ Primarily a functional programming language.
○ Focuses on recursive functions, symbolic computation, and list manipulation.
○ Developers explicitly define procedures or algorithms.
● Prolog:
○ A logic programming language.
○ Focuses on declarative programming, where the programmer specifies
what the solution is, not how to compute it.
○ The system derives solutions using rules and facts through automated
reasoning (backtracking).
2. Syntax
● LISP:
○ Uses prefix notation with extensive use of parentheses.
○ Syntax is highly uniform and uses S-expressions for both code and data.
Prolog:
3. Problem-Solving Approach
● LISP:
○ Problems are solved through procedures and functions explicitly defined by
the programmer.
○ It supports iterative and recursive approaches.
● Prolog:
○ Problems are solved through logic inference.
○ Prolog uses a knowledge base of facts and rules, then searches for a
solution using backward chaining and unification.
4. Core Applications
32
● LISP:
○ Widely used for symbolic computation and problems requiring dynamic
data structures.
○ Common in areas like:
■ Natural Language Processing (NLP)
■ Expert Systems
■ Machine Learning (historical relevance)
● Prolog:
○ Ideal for logical reasoning, knowledge representation, and problems
requiring rule-based inference.
○ Common in:
■ Expert Systems
■ Theorem Proving
■ Semantic Web and Ontologies
5. Execution Model
● LISP:
○ Programs execute as sequences of function calls and expressions.
○ Uses an interpreter or compiler for execution.
● Prolog:
○ Prolog employs a goal-driven execution model.
○ It resolves goals (queries) by applying rules and facts through backtracking.
6. Strengths
● LISP:
○ Highly flexible and extensible.
○ Powerful for recursive algorithms and symbolic computation.
○ Suitable for programs requiring self-modification or dynamic rule creation.
● Prolog:
○ Naturally suited for problems involving logical reasoning, constraint solving,
and relational data.
○ Easier for modeling real-world problems with rules and relationships.
7. Weaknesses
● LISP:
○ Requires a procedural approach, which can be less intuitive for certain logical
problems.
○ Syntax can be verbose and challenging for beginners due to excessive
parentheses.
33
● Prolog:
○ Less efficient for numeric computation or procedural tasks.
○ Debugging can be challenging, especially in complex rule bases.
34
1. Input Operations
● read: Reads a single LISP object (e.g., number, symbol, or list) from the input.
2. Output Operations
● The let construct allows you to declare local variables and their values within a
specific scope.
● Syntax:
1. Interaction in LISP
Interaction in LISP refers to taking input from the user and providing output dynamically. This
is commonly achieved using I/O functions like read, read-line, write, write-line,
and format.
(defun ask-for-name ()
(ask-for-name)
Explanation:
1. format t: This prints to the console. The t specifies the output stream (t refers to
standard output).
○ "What is your name?": The prompt to display.
○ "Hello, ~a!": Uses ~a as a placeholder to insert the value of name.
2. read-line: Captures the input entered by the user as a string.
3. let: Creates a local variable name to hold the user's input.
4. ~%: Prints a newline character for better formatting in output.
Hello, Alice!
36
2. Recursion in LISP
A property list (plist) in LISP is a list where keys and values alternate, often used for simple
key-value data storage. For example:
1. Python: Dictionaries
○ A dictionary is Python's built-in key-value pair data structure, similar to a plist.
python
plist = {"name": "Alice", "age": 25, "city": "New York"}
2.
3. JavaScript: Objects
○ JavaScript objects serve as key-value stores, similar to property lists.
javascript
let plist = { name: "Alice", age: 25, city: "New York" };
4.
5. Ruby: Hash
○ Ruby's Hash is a key-value data structure akin to a plist.
6. ruby
plist = { name: "Alice", age: 25, city: "New York" }
2. Array Alternatives
Arrays in LISP are flexible multi-dimensional structures, often initialized and accessed with
built-in functions like make-array and aref.
1. Python: Lists
○ Python lists serve as dynamic arrays for holding sequential data.
python
array = [1, 2, 3, 4]
38
2.
3. JavaScript: Arrays
○ JavaScript provides dynamic arrays with built-in methods.
javascript
let array = [1, 2, 3, 4];
let element = array[0];
4.
5. Ruby: Arrays
○ Ruby arrays work much like Python lists.
ruby
array = [1, 2, 3, 4]
6. element = array[0]
39
Examples of WFFs:
1. Atomic Formulae:
○ The simplest WFFs are atomic formulae, such as P(x)P(x)P(x) or QQQ.
○ They contain no logical connectives.
2. Compound Formulae:
○ Constructed by combining atomic formulae with logical connectives.
○ Example: P∧QP \wedge QP∧Q, ¬P\neg P¬P, P→QP \rightarrow QP→Q.
3. Quantifiers:
○ Use of universal (∀\forall∀) or existential (∃\exists∃) quantifiers.
○ Example: ∀x(P(x)→Q(x))\forall x (P(x) \rightarrow Q(x))∀x(P(x)→Q(x)).
4. Parentheses:
○ Parentheses are used to clarify the precedence of operations.
○ Example: P∧(Q∨R)P \wedge (Q \vee R)P∧(Q∨R) is different from
(P∧Q)∨R(P \wedge Q) \vee R(P∧Q)∨R.
1. Logical Connectives:
○ ¬\neg¬: Negation (not)
○ ∧\wedge∧: Conjunction (and)
○ ∨\vee∨: Disjunction (or)
○ →\rightarrow→: Implication (if-then)
○ ↔\leftrightarrow↔: Biconditional (if and only if)
2. Quantifiers:
40
Non-deductive inference methods involve reasoning processes where the conclusions are
not guaranteed to be true, even if the premises are true. Instead, these methods provide
conclusions that are probable, plausible, or likely based on the evidence. Unlike
deductive reasoning, which is strictly logical and guarantees certainty, non-deductive
reasoning accommodates uncertainty and incomplete information.
1. Inductive Reasoning
2. Abductive Reasoning
● Definition: Starts with an observation and seeks the most likely explanation.
● Key Feature: Often referred to as "inference to the best explanation."
● Example:
○ Observation: The ground is wet.
○ Possible Explanations:
1. It rained.
2. Someone spilled water.
○ Conclusion: It likely rained (the most plausible explanation).
● Use in AI: Diagnostic systems (e.g., medical diagnosis or fault detection) use
abduction to find probable causes for observed symptoms or failures.
3. Analogical Reasoning
4. Statistical Reasoning
5. Heuristic Reasoning
6. Fuzzy Logic
● Definition: Reasoning based on degrees of truth rather than binary true/false values.
● Key Feature: Handles uncertainty and vagueness.
● Example:
○ Premise: The weather is "somewhat hot."
○ Conclusion: It’s likely summer, but not guaranteed.
● Use in AI: Fuzzy control systems are used in appliances like washing machines and
air conditioners to handle vague inputs.
7. Default Reasoning
8. Commonsense Reasoning
Example All humans are mortal. Socrates is a Most humans enjoy music. John is a
human. → Socrates is mortal. human. → John likely enjoys music.
Conclusion
Non-deductive inference methods are essential for reasoning in real-world scenarios, where
information is often incomplete or uncertain. They are widely applied in artificial
intelligence for tasks such as learning, diagnosis, and decision-making, bridging the gap
between theoretical reasoning and practical applications.
44
Key Concepts
1. Inconsistencies in TMS
Inconsistencies occur when a knowledge base contains contradictory information. This can
happen in reasoning systems when:
Example of Inconsistency:
This creates a logical inconsistency because if AAA is true and A→BA \rightarrow BA→B,
BBB must be true.
2. Uncertainties in TMS
Example of Uncertainty:
Here, uncertainty arises about whether P(x)P(x)P(x) implies xxx can fly.
1. Default Reasoning
Definition:
Key Features:
Example:
However, if new information reveals that Tweety is a penguin, the system retracts the
conclusion.
Applications:
Challenges:
● Prioritization: Determining which defaults to apply when multiple ones are relevant.
Definition:
The closed world assumption is the principle that anything not explicitly stated to be true
is assumed to be false. It simplifies reasoning by assuming the system has complete
knowledge of the world.
Key Features:
Example:
Applications:
● Databases: Relational databases often use CWA when queries return "false" for
missing information.
● Logic Programming: Prolog uses CWA to infer negative facts when a query fails to
find evidence.
Challenges:
● Incomplete Knowledge: CWA assumes that the system knows everything relevant,
which may not be true in real-world scenarios.
● Open World Assumption (OWA): In contrast to CWA, OWA assumes that the
absence of information does not imply falsity, which is more suitable for dynamic or
incomplete environments.
48
Handling Allows for exceptions and overrides. Assumes missing facts are
Uncertainty false.
Example "Birds typically fly." Tweety can fly "Bob is not a teacher" if not
unless proven otherwise. explicitly stated in the database.
49
Model
Applications:
● Machine Learning: Models learn patterns and make predictions (e.g., neural
networks).
● Expert Systems: Logical models represent domain knowledge for reasoning.
● Simulations: Models simulate real-world processes for testing and optimization.
Temporal Logic
Temporal Operators:
51
UNIT 3
Fuzzy Logic-
Fuzzy Logic in Artificial Intelligence with Example | Artificial Intelligence
1. Probability:
○ Quantifies uncertainty, ranging from 000 (impossible) to 111 (certain).
○ Example: The probability of rain tomorrow might be 0.7 (70%).
2. Random Variables:
○ Variables that can take on different values, each with a probability.
○ Example: X represents weather, with values {Sunny, Rainy, Cloudy}.
1. Expert Systems:
○ Medical diagnosis (e.g., probability of a disease given symptoms).
2. Speech and Language Processing:
○ Predicting words or phrases based on probabilistic models.
3. Robotics:
○ Navigation and obstacle detection in uncertain environments.
4. Fraud Detection:
○ Estimating the likelihood of fraudulent activity in transactions.
52
5. Autonomous Vehicles:
○ Predicting pedestrian or vehicle behavior in traffic.
Conclusion
Disadvantages
Conclusion
OR
The Dempster-Shafer Theory (DST) is a way to handle uncertainty when making decisions.
It helps combine information from different sources, even if some of the information is
unclear or conflicting. DST works by giving "probabilities" to different possible outcomes, but
these probabilities can be vague or incomplete. Instead of just saying something is likely or
unlikely, DST also gives a belief (how much evidence supports an outcome) and a
plausibility (how possible an outcome is, even if the evidence isn’t clear). It combines
information from multiple sources using a rule called Dempster’s Rule. DST is useful when
there’s not enough clear data, and it can help in situations like medical diagnosis, sensor
fusion, or decision-making. It’s more flexible than traditional methods because it works
with uncertain and conflicting information, but it can be a bit complex and slow when there’s
too much disagreement in the data
1. Flexibility: DST allows for reasoning with uncertain and conflicting information
from different sources.
2. No need for precise probabilities: DST doesn't require the exact probabilities of
events, allowing it to work with imprecise or vague data.
3. Belief and Plausibility: DST provides not just a probability but also the belief and
plausibility of hypotheses, giving a deeper insight into the confidence level of
conclusions.
1. Sensor Fusion:
○ Combining data from multiple sensors with potentially conflicting readings to
form a unified conclusion.
2. Medical Diagnosis:
○ Combining multiple diagnostic tests or medical opinions to form a final
diagnosis.
3. Robotics:
○ Fusion of data from multiple sources, like cameras, LIDAR, and sensors, to
make decisions in an uncertain environment.
4. Decision-Making:
○ Helping decision-makers combine various sources of uncertain information to
make informed choices.
.
57
Here are some common ways DST can represent words or concepts:
1. Belief:
○ A measure of how much evidence supports a certain outcome.
○ Words: Certain, Confident, Strongly believe, Supported.
2. Plausibility:
○ A measure of how possible an outcome is, even without strong evidence.
○ Words: Possible, Likely, Could be, Not ruled out.
3. Frame of Discernment:
○ The set of all possible outcomes.
○ Words: Choices, Options, Alternatives.
4. Basic Probability Assignment (BPA):
○ A mass or weight given to different subsets of possible outcomes.
○ Words: Likelihood, Weight, Value, Confidence level.
5. Conflict:
○ When two sources of evidence disagree with each other.
○ Words: Disagreement, Contradiction, Uncertainty, Conflict.
1. Problem-Specific:
○ Ad-hoc methods are created to address particular problems or situations,
often without aiming for broad generalization.
2. Quick Solutions:
○ These methods are used when there is no clear or efficient solution available,
and quick action is needed. For example, they can be used to handle
unexpected errors or outliers in data.
3. Non-Standardized:
○ These methods lack the formal structure or guarantees that more rigorous
algorithms have. They're often based on trial and error, heuristics, or expert
judgment.
4. Example in AI:
○ In machine learning, an ad-hoc method might be used to adjust certain
parameters or make specific decisions based on expert intuition, rather than
relying on generalizable algorithms or models.
5. Flexibility:
○ They can adapt to different types of problems and can be modified easily
when new data or issues arise.
Example
An ad-hoc method might be used to detect spam emails. Instead of using a trained
machine learning model, a set of rules (like looking for certain keywords) may be created
quickly to address the immediate need, though this solution might not scale well for more
complex cases.
● Quick and Practical: Useful when a fast solution is required, or when a problem is
highly specific.
● Flexibility: Can be easily adapted to new problems or changes in requirements.
● Simplicity: Often easier to implement than more sophisticated or formal methods.
● Not Generalizable: They are tailored to specific problems and might not work well in
different contexts.
● Lack of Robustness: These methods may fail when faced with new, unforeseen
challenges or complexities.
● Short-Term Solutions: They may provide immediate relief but are not often
sustainable long-term without further refinement.
Conclusion
Ad-hoc methods play a vital role in AI, especially in situations where quick, problem-specific
solutions are needed. While they are effective in certain scenarios, they may not always
provide the best long-term or scalable solutions.
60
Graphs are a powerful way to represent structured knowledge in Artificial Intelligence (AI).
They provide a flexible, visual means of modeling relationships between various entities,
making them useful for representing complex systems of knowledge.
OR
What is a Graph?
Uses of Graphs in AI
1. Knowledge Representation:
○ Graphs can be used to represent semantic networks, which organize
knowledge in terms of relationships between concepts.
○ Example: In a semantic network, nodes might represent concepts like "Dog"
or "Animal", and edges represent relationships like "is a type of".
2. Search and Pathfinding:
○ Graphs are commonly used in AI for search algorithms, like finding the
shortest path in a maze or between two points on a map.
○ Example: Algorithms like Dijkstra’s Algorithm and A (A-star)* use weighted
graphs to find the most efficient path.
3. Recommendation Systems:
○ Graphs can represent user preferences, where nodes are users, products, or
services, and edges represent interactions or preferences.
○ Example: If two users buy similar products, the edge between them would
suggest a recommendation for future purchases.
4. Social Networks:
○ In social network analysis, graphs are used to represent relationships
between individuals, such as friendships, followers, or group memberships.
○ Example: Facebook and Twitter use graphs to connect users with friends or
followers.
5. Natural Language Processing (NLP):
○ Graphs can represent word relationships, such as in word networks or
semantic graphs.
○ Example: A graph might represent relationships between synonyms,
antonyms, and related concepts.
6. Expert Systems:
○ Knowledge in expert systems is often represented as a graph to show how
various facts and rules are related to one another, enabling reasoning and
decision-making.
1. Scalability: As the graph grows larger, computations like searching and updating can
become complex and slow.
2. Complexity: Representing knowledge with graphs can become highly intricate,
especially for large and interconnected datasets.
3. Data Quality: Incomplete or inaccurate edges (relationships) can negatively affect
the performance of AI systems.
Conclusion
Graphs are a foundational tool in AI, providing an effective and flexible method for
structuring knowledge. Whether it's for representing relationships, navigating through large
datasets, or powering recommendation systems, graphs help make sense of complex
information in a way that is easily interpretable.
63
What is a Frame?
1. Slot:
○ A slot represents an attribute of the object or situation. It defines a property or
characteristic that can hold specific values.
○ Example: For the frame "Car", a slot might be "color", and the value could be
"red".
2. Value:
○ The value is the data associated with the slot. It describes a specific
characteristic of the object or situation.
○ Example: The value for the "color" slot in the "Car" frame might be "blue".
3. Default Values:
○ Frames often include default values for certain slots if specific information is
not provided.
○ Example: If no value is provided for the "engine type" slot, the frame might
default to "internal combustion engine".
4. Inheritance:
○ Frames can inherit properties from other frames, allowing for a hierarchy of
frames. This is similar to object-oriented programming where a subclass can
inherit the characteristics of a superclass.
○ Example: A "Sports Car" frame might inherit properties from a "Car" frame but
also have additional slots for speed or design.
5. Procedures or Actions:
64
1. Organization:
○ Frames provide a clear structure for organizing complex information, breaking
down knowledge into manageable components.
2. Inheritance:
○ Frames allow for inheritance, meaning new frames can inherit properties from
existing ones, which reduces redundancy.
3. Default Values:
○ Frames can include default values, making them useful for situations where
some information is missing or unknown.
4. Modularity:
○ Frames are modular and can be easily updated or extended by adding new
slots or changing the values of existing slots.
5. Efficiency:
○ Frames allow for fast retrieval and updating of knowledge, especially in expert
systems where many facts need to be processed quickly.
Applications of Frames in AI
1. Expert Systems:
○ Frames are often used to represent knowledge in expert systems, where
they model specific knowledge about a domain.
○ Example: MYCIN, an expert system for medical diagnosis, uses frames to
represent medical knowledge and reasoning.
2. Natural Language Processing (NLP):
○ Frames are used in NLP for syntactic and semantic parsing. Frames help to
represent word meanings and sentence structures in a flexible way.
○ Example: In a sentence like "John kicked the ball," frames might represent
"John" as an agent and "ball" as the object.
Conclusion
Frames are a powerful tool in AI for representing structured knowledge. They help organize
and model information about objects, situations, and their relationships in a way that is both
flexible and efficient. Through concepts like slots, inheritance, and default values, frames
provide a structured way to reason and process complex knowledge. Whether in expert
systems, robotics, or natural language processing, frames play a key role in enabling
intelligent behavior in AI systems.
65
A class is a blueprint or template that defines the properties and behaviors of a particular
type of object. It specifies what attributes (data) the object will have and what actions
(methods) can be performed on or by the object.
1. Class Name:
The name of the class, representing the type of objects that it defines.
○ Example: "Car", "Animal", "Person".
2. Attributes:
The data fields that represent the properties of the objects.
○ Example: "color," "speed," or "weight."
3. Methods:
Functions or procedures associated with the objects that define the behavior of the
objects.
○ Example: "drive()" or "bark()" for a car or dog object.
4. Constructor:
A special method that is used to create new instances of the class (objects). It
initializes the object's attributes.
○ Example: A constructor might set default values like setting the "color" of the
"Car" object to "red."
66
Object classes provide an efficient way to represent knowledge in AI. Here’s how they can
be used:
1. Modularity:
○ Classes allow the division of complex systems into smaller, manageable
parts, making development and maintenance easier.
2. Reusability:
○ Once a class is defined, it can be reused to create multiple instances
(objects). Also, classes can be extended using inheritance, reducing
redundancy.
3. Flexibility:
○ By using polymorphism, objects can exhibit different behaviors based on their
class, allowing for flexible behavior in AI systems.
67
4. Maintainability:
○ Since classes are self-contained, changes to one class generally do not affect
other classes, making it easier to update or modify AI systems.
Conclusion
Object classes are a core concept in object-oriented representations used in AI. They
help in organizing complex systems into manageable components with attributes and
methods. By utilizing concepts like inheritance, polymorphism, and encapsulation, AI
systems can model real-world entities and their interactions efficiently and flexibly.
Object-oriented representations are widely used in various AI applications such as expert
systems, robotics, and natural language processing.
68
A method is a function or procedure that is associated with an object. It defines the behavior
of that object—essentially what actions or operations an object can perform.
A message is the signal or request sent to an object to invoke a method. It is the means by
which an object communicates with other objects, asking them to perform actions (methods).
1. Java:
2. Python:
3. C++:
4. C#:
5. Ruby:
6. Swift:
Swift is a powerful and intuitive programming language developed by Apple for iOS,
macOS, watchOS, and tvOS applications. It is a modern OOP language designed to
be fast, safe, and expressive.
7. Kotlin:
Kotlin is a modern programming language that runs on the Java Virtual Machine
(JVM) and is fully interoperable with Java. It is used primarily for Android app
development and backend services.
8. PHP:
These languages enable the use of key OOP concepts like classes, inheritance, and
polymorphism for better modularity and code reusability.
71
Search Strategies:
Search strategies refer to the methods used to explore the solution space for finding an
optimal or feasible solution to a problem. These strategies can be broadly classified into
uninformed (blind) search and informed (heuristic) search.
These strategies do not have any information about the problem beyond the initial state and
goal. They explore the solution space systematically.
1. Breadth-First Search (BFS): Explores all the possible nodes level by level from the
starting node. Works on FIFO (Queue)
Breadth First Search (BFS) with example | Uninformed Search | Artificial Intellig…
2. Depth-First Search (DFS): Explores as far as possible down each branch before
backtracking. Works on LIFO (Stack)
Depth First Search (DFS) with example | Uninformed Search | Artificial Intellige…
1. A Search*: Combines the best features of BFS and heuristic search. It uses a
heuristic function to estimate the cost from the current node to the goal.
○ Advantages: Guarantees optimal solution if the heuristic is admissible.
2. Greedy Best-First Search: Chooses the node that appears to be closest to the goal
based on the heuristic.
72
○ Advantages: Fast, but may not always find the optimal solution.
Control Strategies:
Control strategies determine how the AI system navigates through the search process,
focusing on how the search is carried out based on the current state, available knowledge,
and resources.
1. Depth-Limited Search: Limiting the depth of the search to avoid excessive memory
usage or infinite loops. Useful in cases where you have an idea of the depth of a
solution.
2. Iterative Deepening Search: Combines the benefits of BFS and DFS by repeatedly
running depth-limited search with increasing limits.
○ Advantages: Finds the solution efficiently and uses less memory than BFS.
3. Greedy Search: Uses only the heuristic information to expand nodes that seem
closest to the goal, without considering the path cost.
○ Advantages: Quick but not guaranteed to be optimal.
4. Hill Climbing: An iterative process that moves towards the direction that leads to an
improvement (i.e., a higher value or closer to the goal).
○ Advantages: Simple and fast, but may get stuck in local optima.
● Pathfinding: In robotics or games, searching for the shortest or most efficient path.
● Optimization Problems: Such as scheduling, resource allocation, or solving
puzzles.
● Decision-Making: Used in AI systems like game-playing agents or autonomous
vehicles.
These search and control strategies are fundamental to AI, helping it solve problems by
systematically navigating through the solution space and making intelligent decisions based
on available information.
73
● AND Nodes: These nodes represent tasks or subproblems where all child nodes
must be solved to satisfy the parent node. This means the solution requires all the
conditions or actions at the child nodes to be satisfied simultaneously.
○ Example: In a puzzle, the parent node could represent a state that needs
multiple smaller conditions (like placing different puzzle pieces) to be
completed at once.
● OR Nodes: These nodes represent alternative paths where only one of the child
nodes must be solved to satisfy the parent. This means the solution requires one of
the options to be completed.
○ Example: In a decision-making process, the parent node might represent a
decision point with multiple possible options (like choosing between different
routes), and solving one of them leads to a solution.
In this example:
● The robot has two options: go to the kitchen or the living room (OR nodes).
● Once it chooses a path (kitchen or living room), it must complete all tasks in that path
(AND nodes).
3. Flexibility: Useful in problems where decisions or tasks can be broken down into
multiple sub-tasks that must either be completed together (AND) or independently
(OR).
75
UNIT 4
Knowledge Organization and Communication in Expert
Systems
In expert systems, knowledge organization and communication are essential for solving
problems effectively. Matching is a critical process used to align user inputs with the stored
knowledge to generate solutions or advice. Here's an overview of the key concepts:
Matching is the process of comparing user-provided information (facts or queries) with the
rules or knowledge stored in the system. It ensures that the appropriate knowledge is
applied to solve the given problem.
● Example: If a medical expert system receives symptoms like "fever" and "cough,"
matching is used to compare these symptoms with stored disease patterns to
suggest possible diagnoses.
1. Problem Identification: To find which stored knowledge (rule or case) applies to the
user's problem.
2. Decision-Making: To determine the best course of action or recommendation.
3. Efficiency: To reduce unnecessary processing by focusing only on relevant parts of
the knowledge base.
3. Matching Problems
● Dynamic Knowledge: If the knowledge base evolves, previously matched rules may
no longer apply.
4. Partial Matching
Partial matching allows the system to handle incomplete or inexact input data by finding the
closest possible match rather than an exact match.
● Definition: Partial matching identifies rules or cases that partially satisfy the user's
input conditions when an exact match is unavailable.
● Example: In a customer support system, if a user reports "internet issue," the system
might partially match this input to stored rules for "slow internet" or "no internet."
● Benefits: Enables flexibility in decision-making, especially in cases where data is
incomplete or noisy.
In summary, matching is a core process in expert systems for aligning user inputs with
stored knowledge. It ensures efficient and effective problem-solving, with partial matching
enhancing flexibility when inputs are incomplete or uncertain.
OR
Matching is the process by which the system determines which piece of knowledge (rules,
facts, or cases) in the knowledge base applies to the current problem or query provided by
the user.
How it Works:
● Pattern Matching: Involves identifying patterns in the input data that correspond to
stored patterns.
○ Example: Recognizing text, speech, or visual data patterns.
1. Exact Matching: All input conditions must match exactly with stored rules or cases.
2. Partial Matching: Only a subset of input conditions needs to match (explained
further below).
3. Fuzzy Matching: Matches based on degrees of similarity using fuzzy logic for
uncertain or vague inputs.
Key Reasons:
Use Cases:
3. Matching Problems
Despite its importance, matching in expert systems can face challenges due to the
complexity and variability of input data.
78
Challenges:
4. Partial Matching
Partial matching allows an expert system to handle incomplete, inexact, or noisy input data
by finding a solution that partially satisfies the input conditions.
How it Works:
● Instead of requiring all input conditions to match exactly, the system identifies the
closest match based on a subset of conditions.
○ Example: If a rule requires "fever, cough, and fatigue" but the user input only
provides "fever and cough," partial matching can still suggest the rule.
Key Features:
Benefits:
79
Fuzzy matching-
https://redis.io/blog/what-is-fuzzy-matching/
(FM), also known as fuzzy logic, approximate string matching, fuzzy name matching, or
fuzzy string matching is an artificial intelligence and machine learning technology that
identifies similar, but not identical elements in data table sets. FM uses an algorithm to
navigate between absolute rules to find duplicate strings, words/entries, that do not
immediately share the same characteristics. Where typical search logic operates on a binary
pattern, (i.e.: 0:1, yes/no, true/false, etc) – fuzzy string matching instead finds strings,
entries, and/or text in datasets that fall in the in-between of these definitive parameters and
navigates intermediate degrees of truth.
Approximate string matching assists in finding approximate matches, even when certain
words are misspelled, abbreviated, or omitted, a function heavily used in search engines. In
the end, approximate string matching provides a match score and since it is used to identify
words, phrases, and strings that are not a perfect fuzzy match, the match score will not be
100%.
Levenshtein distance
The Levenshtein Distance (LD) is one of the fuzzy matching techniques that measure
between two strings, with the given number representing how far the two strings are from
being an exact match. The higher the number of the Levenshtein edit distance, the further
the two terms are from being identical.
For example, if you are measuring the distance between “Cristian” and “Christian,” you’d
have a distance of 1 since you’d be one “h” away from an exact match.
Hamming distance
81
Named for American mathematician Richard Hamming, the Hamming distance (HD) is quite
similar to Levenshtein, except that it is primarily utilized in signal processing, whereas the
former is often used to calculate the distance in textual strings. This algorithm uses the
ASCII (American Standard Code for Information Interchange) table to determine the binary
code assigned to each letter in each string to calculate the distance score.
Advantages-
● Accuracy: FM is far more granular than deterministic matching, with the capability of
searching for matches using imprecise data, penetrating deeper than classical binary
strings
● Flexibility: The various fuzzy logic algorithms available make it possible to solve for
most complex issues
● Easy to build: Implementing fuzzy logic into your system is a simple process
● Configurable: It’s easy to modify the logic to suit your specific needs
1. Search Engines:
○ When users input misspelled queries, fuzzy matching retrieves relevant
results.
○ Example: Searching for "recipie" retrieves results for "recipe."
2. Spell Checkers and Auto-Correct:
○ Suggests corrections for misspelled words using fuzzy matching.
○ Example: Typing "acommodation" suggests "accommodation."
3. Data Deduplication:
○ Identifies duplicate records in databases that might not be exact matches.
○ Example: "John Doe" and "Jon Doe" are treated as the same person.
4. Recommendation Systems:
○ Suggests similar products, movies, or content based on partial matches.
○ Example: Searching for "Harry Porter" suggests "Harry Potter."
5. Medical Systems:
○ Matches symptoms or conditions with stored data even if input is vague or
incomplete.
○ Example: Matching "high fever" with "fever" and suggesting a diagnosis.
82
The RETE algorithm minimizes redundant computations by organizing rules and facts in a
structured way and reusing intermediate results. It is particularly useful in systems where the
knowledge base has a large number of rules.
1. Rule-Based System:
○ Rules consist of conditions (IF part) and actions (THEN part). The RETE
algorithm matches facts to the conditions in rules.
Example Rule:
IF temperature > 100 AND pressure < 50 THEN trigger alert.
○
2. Facts:
○ Pieces of data provided to the system.
Example Fact:
temperature = 110, pressure = 40.
○
3. Matching Process:
○ RETE efficiently matches facts against the conditions in multiple rules
simultaneously.
The RETE algorithm operates by maintaining a network of nodes that represent rule
conditions and their relationships. Here's an overview of its working:
1. RETE Network:
● The RETE network is a directed acyclic graph consisting of two types of nodes:
○ Alpha Nodes: Represent simple conditions on a single fact (e.g.,
temperature > 100).
○ Beta Nodes: Represent combinations of conditions across multiple facts
(e.g., temperature > 100 AND pressure < 50).
83
2. Input Facts:
3. Partial Matches:
● Matches are propagated to Beta nodes, where conditions from multiple facts are
combined.
● Example: If temperature = 110 and pressure = 40, the Beta node for the rule
temperature > 100 AND pressure < 50 will match both.
4. Activation:
● When all conditions of a rule are satisfied, the rule is "activated" and added to the
agenda (list of rules to be executed).
5. Efficiency:
● RETE avoids re-evaluating unchanged facts. Only new or modified facts are
processed, which reduces redundant computations.
Advantages of RETE
Disadvantages of RETE
1. Memory Usage:
○ RETE can consume significant memory to store the network and intermediate
results.
2. Complexity:
○ The algorithm is more complex compared to simpler matching methods,
requiring expertise to implement and optimize.
84
1. Indexing Techniques
1. Inverted Index:
○ Common in text-based systems like search engines.
○ Maps each keyword or term to the documents containing that term.
○ Example: A search for "Artificial Intelligence" will retrieve all documents
containing both terms.
2. Hashing:
○ Converts data (e.g., text, keys) into fixed-length hash codes.
○ Efficient for exact matches.
○ Example: Looking up a person’s details using their unique ID.
3. Tree-Based Indexing:
○ Uses hierarchical data structures like B-Trees or Binary Search Trees.
○ Efficient for range queries or sorted data retrieval.
○ Example: Searching for records in a database based on numerical ranges like
age or salary.
4. Clustering:
○ Groups similar data points or knowledge items based on shared
characteristics.
○ Example: Grouping documents by topic or keywords.
5. Semantic Indexing:
○ Based on the meaning of content rather than exact keywords.
○ Example: Searching for "car" retrieves documents about "automobiles."
2. Retrieval Techniques
Retrieval is the process of locating and returning relevant information based on a user query.
1. Boolean Retrieval:
○ Uses logical operators like AND, OR, and NOT to match queries.
○ Example: Searching for "AI AND Machine Learning" retrieves documents
containing both terms.
2. Keyword-Based Retrieval:
85
1. Search Engines:
○ Use indexing and retrieval to rank and display relevant results quickly.
2. Expert Systems:
○ Match user queries to a knowledge base for decision-making.
3. Databases:
○ Retrieve records efficiently using indexing.
4. Recommendation Systems:
○ Retrieve similar items (movies, products) based on user preferences.
86
1. Knowledge Representation:
○ Knowledge is represented in a structured format to ensure its storage and
accessibility.
○ Example: Frames, semantic networks, rules, or object-oriented models.
2. Knowledge Storage:
○ Knowledge is stored in memory structures, which could be:
■ Declarative Memory: Facts and data.
■ Procedural Memory: Processes and actions.
3. Knowledge Mapping:
○ Relationships between knowledge elements are established, allowing for
logical connections.
○ Example: Associating the concept of "bird" with "flies" and "has feathers."
4. Dynamic Updating:
○ Systems must integrate new knowledge while maintaining consistency.
○ Example: Learning a new rule or updating an existing fact in the system.
5. Hierarchical Organization:
○ Knowledge is often stored hierarchically for better organization.
○ Example: Inheritance in object-oriented systems, where subclasses inherit
properties of superclasses.
1. Semantic Networks:
○ Knowledge is represented as a graph of nodes (concepts) and edges
(relationships).
○ Example: Representing "dog" as a node connected to "mammal," "barks," and
"pet."
2. Frames:
○ Use data structures to represent stereotypical knowledge.
○ Example: A frame for "car" may include attributes like "make," "model,"
"color," and "engine."
3. Rules:
○ Represent knowledge as IF-THEN statements.
○ Example: IF the weather is rainy, THEN carry an umbrella.
87
1. Chunking:
○ Grouping related pieces of knowledge into chunks for easier retrieval.
○ Example: Grouping information about "birds" into a chunk that includes
"sparrow," "eagle," and "penguin."
2. Indexing:
○ Creating an index for quick access to stored knowledge.
○ Example: Using keywords or metadata for faster retrieval in a database.
3. Association:
○ Linking related pieces of knowledge to enable inferencing.
○ Example: Associating "fire" with "heat," "danger," and "extinguishers."
1. Scalability:
○ Managing large volumes of knowledge without performance issues.
2. Consistency:
○ Ensuring that integrated knowledge is accurate and non-conflicting.
3. Dynamic Updates:
○ Incorporating new knowledge while maintaining existing structures.
4. Inference Complexity:
○ Balancing the speed and accuracy of reasoning with integrated knowledge.
88
1. Sensing:
○ The system gathers raw data from the environment using sensors.
○ Example: A camera for vision, a microphone for sound, or a lidar sensor for
spatial mapping.
2. Signal Processing:
○ The raw sensory data is converted into a form that can be analyzed.
○ Example: Converting an audio signal into a spectrogram for voice recognition.
3. Feature Extraction:
○ Relevant features or patterns are identified from the processed data.
○ Example: Detecting edges, shapes, or colors in an image.
4. Interpretation:
○ The extracted features are analyzed to understand the environment.
○ Example: Recognizing a face in an image or a word in speech.
5. Decision-Making:
○ Based on the interpreted data, the system decides on the next action.
○ Example: A self-driving car recognizing a pedestrian and stopping.
Types of Perception in AI
1. Visual Perception:
○ Focuses on interpreting images or videos.
○ Applications: Facial recognition, object detection, autonomous driving.
2. Auditory Perception:
○ Involves understanding sound and speech.
○ Applications: Voice assistants (e.g., Alexa, Siri), speech-to-text systems.
3. Tactile Perception:
○ Interprets touch and physical sensations.
○ Applications: Robotics, prosthetic limbs.
Applications of Perception in AI
1. Autonomous Vehicles:
○ Perceive the environment using cameras, lidar, and radar to detect objects,
lanes, and pedestrians.
2. Surveillance Systems:
89
3. Voice Assistants:
Example of AI Perception
In a self-driving car:
Expert systems are AI-based software designed to simulate the decision-making ability of a
human expert. Communication in expert systems is a crucial aspect that facilitates
interaction between the system, its knowledge base, and the users, ensuring effective
decision-making and problem-solving.
1. User Interface:
○ The interface through which users interact with the system.
○ Role: Accepts user inputs (queries, data) and presents outputs
(recommendations, solutions).
○ Example: A GUI (Graphical User Interface) in a medical diagnosis expert
system.
2. Inference Engine:
○ The reasoning component that communicates with the knowledge base to
derive conclusions.
○ Role: Applies logical rules to the knowledge base to infer new knowledge or
solutions.
○ Example: A rule-based engine deducing a medical diagnosis from symptoms.
3. Knowledge Base:
○ Stores facts and rules relevant to a specific domain.
○ Role: Communicates knowledge to the inference engine when queried.
○ Example: A database of diseases and their symptoms in a medical expert
system.
4. Explanation Facility:
○ Provides explanations to users about how conclusions were derived.
○ Role: Enhances user trust and understanding of the system's reasoning.
○ Example: Explaining why a certain treatment was recommended.
5. Communication Language:
○ The format or medium used for communication between components and
users.
○ Role: Can include natural language, symbolic representations, or graphical
outputs.
○ Example: Using charts, graphs, or plain text to display results.
1. User Interface:
○ The interface through which users interact with the system.
○ Role: Accepts user inputs (queries, data) and presents outputs
(recommendations, solutions).
○ Example: A GUI (Graphical User Interface) in a medical diagnosis expert
system.
2. Inference Engine:
○ The reasoning component that communicates with the knowledge base to
derive conclusions.
○ Role: Applies logical rules to the knowledge base to infer new knowledge or
solutions.
○ Example: A rule-based engine deducing a medical diagnosis from symptoms.
3. Knowledge Base:
○ Stores facts and rules relevant to a specific domain.
○ Role: Communicates knowledge to the inference engine when queried.
○ Example: A database of diseases and their symptoms in a medical expert
system.
4. Explanation Facility:
○ Provides explanations to users about how conclusions were derived.
○ Role: Enhances user trust and understanding of the system's reasoning.
○ Example: Explaining why a certain treatment was recommended.
5. Communication Language:
○ The format or medium used for communication between components and
users.
○ Role: Can include natural language, symbolic representations, or graphical
outputs.
○ Example: Using charts, graphs, or plain text to display results.
Linguistics
is the study of language. It looks at how languages are made, how they work, and how
people use them to communicate. Linguistics helps us understand the building blocks of
language, like sounds, words, and sentences, and how we use them to share ideas.
1. Phonetics:
○ This is about the sounds we make when we speak.
○ Example: How we say the sounds in "cat" and "dog."
2. Phonology:
○ This looks at how sounds are used in a language.
○ Example: The difference between the "b" sound in "bat" and "p" in "pat."
3. Morphology:
○ This is about how words are formed and put together.
○ Example: The word "undo" is made of "un-" (meaning "not") and "do."
4. Syntax:
○ This is the study of how words are put together in sentences.
○ Example: In English, we say "The dog barks," not "Barks dog the."
5. Semantics:
○ This looks at the meaning of words and sentences.
○ Example: The word "bank" can mean a place where you keep money or the
side of a river.
6. Pragmatics:
○ This is about how the situation affects how we understand language.
○ Example: If someone says, "Can you pass the salt?" they're usually asking for
the salt, not testing your ability to pass it.
7. Sociolinguistics:
○ This studies how language changes in different social groups or places.
○ Example: Different accents or slang words used by people in different
regions.
8. Psycholinguistics:
○ This is the study of how we think and process language.
○ Example: How babies learn to talk or how people understand spoken words.
9. Historical Linguistics:
○ This looks at how languages change over time.
○ Example: How English has changed from Old English to Modern English.
10. Computational Linguistics:
○ This uses computers to understand and process language.
○ Example: When you use Google Translate or voice recognition, that’s
computational linguistics in action.
1. Agent Specification
Agent specification involves defining the structure and behavior of the agent. This
includes setting up the goals, actions, and the environment in which the agent operates. It is
essentially the design phase where you determine what the agent will do.
● Define the Environment: Understand the environment the agent will interact with
(e.g., a robot in a room, a virtual character in a game, etc.).
● Goals and Objectives: Define what the agent aims to achieve (e.g., reach a
destination, play a game, answer questions).
● Perception: Specify how the agent perceives the environment. This could include
sensors (vision, sound, etc.).
● Actions: Identify the actions the agent can take based on its perception (e.g., move
forward, speak, pick up an object).
● Decision-Making: Choose the reasoning method the agent will use to decide which
action to take (e.g., rule-based, machine learning).
● Interaction: Define how the agent will communicate or interact with the environment
or other agents.
2. Agent Simulation
● Develop a Prototype: Create a simplified version of the agent that can be tested and
improved iteratively.
● Test Scenarios: Set up various situations and environments to see how the agent
behaves in different conditions.
● Monitor Performance: Measure how well the agent achieves its goals, how
efficiently it operates, and how it handles challenges or unexpected situations.
97
3. Agent Implementation
Implementation is the phase where the agent is coded and put into operation in the real
world or a fully functioning virtual environment. This phase involves integrating the agent into
its intended platform and testing it under actual working conditions.
● Programming: Write the code for the agent based on the specifications and
decisions made in earlier phases. Use an appropriate programming language (e.g.,
Python, Java, etc.).
● Integration: Implement the agent in its environment, whether physical or virtual. For
robots, this could involve hardware integration (e.g., sensors, motors), and for
software agents, it may involve web interfaces or game engines.
● Testing: Run tests to ensure the agent behaves correctly in real-world scenarios.
These tests might include handling unexpected inputs, optimizing task completion, or
improving resource management.
● Iteration: If the agent performs poorly in certain situations, go back to refine or adjust
its decision-making process or implementation.
● Deployment: Once the agent is fully functional and tested, it is deployed into the final
operating environment. This could be a robot in the field, a chatbot serving
customers, or an autonomous vehicle navigating roads.
1. Semantic Analysis
Semantic analysis refers to the process of examining the meaning of words and sentences.
It tries to understand what words mean, how they combine to form larger meanings, and
how those meanings change depending on the context.
2. Representation Structures
Representation structures are methods used to represent the meanings identified during
semantic analysis. These structures allow systems to work with and reason about meanings.
1. Semantic Networks:
○ A network where concepts are represented as nodes, and relationships
between them are represented as edges.
○ Example: A node for "dog" might be connected to "animal" and "pet,"
representing the hierarchy and relationships.
Example:
Dog → Animal
Dog → Pet
99
2. Frames:
○ Frames are structures that represent stereotyped situations, often including
slots (attributes) and values (specific details).
○ Example: A "restaurant" frame might have slots for "location," "menu," "staff,"
etc.
Summary
Semantic analysis is about extracting meaning from language, and representation structures
are the methods used to store and manipulate that meaning. These structures, such as
semantic networks, frames, and first-order logic, allow machines to understand and reason
with language in a meaningful way. They are foundational to technologies like NLP, machine
learning, and knowledge representation in AI.
100
What is NLG?
NLG is the process of converting data (often from databases or other sources) into natural
language. This process is essential for creating systems that can automatically produce
reports, summaries, explanations, or any other form of text output based on input data.
For example:
1. Content Determination:
○ Decide what information should be included in the output. For example, in a
weather report, the system will determine to include temperature, wind speed,
and precipitation information.
2. Sentence Planning:
○ Organize the selected content into logical sentences. The system decides
how to group the information, what structure to use (e.g., subject-verb-object),
and what grammar rules to follow.
3. Text Generation:
○ Use algorithms to convert the planned sentences into actual text. This step
involves choosing the correct words, applying grammar rules, and ensuring
that the sentences flow coherently.
4. Refinement:
○ Fine-tune the text for readability, style, and tone. This may involve adjusting
the language to match the target audience (e.g., casual vs. formal language).
Applications of NLG
Challenges in NLG