unit 4
unit 4
unit 4
Unit-4
Knowledge Representation
Knowledge Representation and Reasoning (KR, KRR) represents information from the real world for a computer to understand and
then utilize this knowledge to solve complex real-life problems like communicating with human beings in natural language.
Knowledge representation in AI is not just about storing data in a database, it allows a machine to learn from that knowledge and
behave intelligently like a human being.
Objects
Events
Performance
Facts
Meta-Knowledge
Knowledge-base
Now that you know about Knowledge representation in AI, let’s move on and know about the different types of Knowledge.
Why is knowledge representation important?
It’s all about facts and concepts, helping describe things in simple terms.
2. Structural Knowledge (The “How Things Relate” Knowledge)
This knowledge helps AI understand relationships between concepts and objects, aiding problem-solving.
3. Procedural Knowledge (The “How-To” Knowledge)
This is like a manual for tasks, with specific rules and strategies to follow.
4. Meta Knowledge (What We Already Know)
It’s knowledge about knowledge, including categories, plans, and past learning.
5. Heuristic Knowledge (Learning from Experience)
This type helps AI make decisions based on past experiences, like using old techniques to solve new problems.
These types of knowledge equip AI to understand and solve problems, follow instructions, make informed decisions, and adapt to
different situations.
1. Logical Representation
2. Semantic Network Representation
3. Frame Representation
4. Production Rules
1 . Logical Representation
Logical representation is a language with some concrete rules which deals with propositions and
has no ambiguity in representation. Logical representation means drawing a conclusion based on
various conditions. This representation lays down some important communication rules. It
consists of precisely defined syntax and semantics which supports the sound inference. Each
sentence can be translated into logics using syntax and semantics.
Syntax:
o Syntaxes are the rules which decide how we can construct legal sentences in
the logic.
o It determines which symbol we can use in knowledge representation.
o How to write those symbols.
Semantics:
o Semantics are the rules by which we can interpret the sentence in the
logic.
o Semantic also involves assigning a meaning to each sentence.
Logical representation can be categorised into mainly two logics:
Propositional Logics
Predicate logics
1. Logical representations have some restrictions and are challenging to work with.
2. Logical representation technique may not be very natural, and inference may not be so efficient.
Semantic Network is a directed or undirected graph consisting of vertices. These vertices represent concepts and edges, which further
represent semantic relations between concepts, mapping or connecting semantic fields. Moreover, it is termed as Associative Networks,
as it processes the knowledge about accepted meanings in adjacent regions.
Or
Semantic networks are alternative of predicate logic for knowledge representation. In Semantic networks, we can represent our
knowledge in the form of graphical networks. This network consists of nodes representing objects and arcs which describe the
relationship between those objects. Semantic networks can categorize the object in different forms and can also link those objects.
Semantic networks are easy to understand and can be easily extended.
These examples illustrate how semantic networks can represent hierarchical relationships and classifications in various domains, from
biology to programming, making them a versatile tool for organizing and understanding complex information.
Animal Classification:
Nodes: Lion, Tiger, Bear, Wolf
Links: “is a” relation
Labels: Mammal, Carnivore, Predator
Food Hierarchy:
Nodes: Fruit, Apple, Banana, Animal, Lion
Links: “eaten by” relation
Labels: Herbivore, Carnivore, Predator
Programming Concepts:
Nodes: Programming Language, Python, Java, Data Types, Integer
Links: “is a” relation, “has” relation
Labels: High-Level Language, Variable, Numeric Type
Example: Following are some statements which we need to represent in the form of nodes and arcs.
Statements:
a) Jerry is a cat.
b) Jerry is a mammal
c) Jerry is owned by Priya.
d) Jerry is brown colored.
e) All Mammals are animal.
In the above diagram, we have represented the different type of knowledge in the form of nodes and arcs. Each object is connected
with another object by some relation.
1. Semantic networks try to model human-like memory (Which has 1015 neurons and links) to store the information, but in
practice, it is not possible to build such a vast semantic network.
2. These types of representations are inadequate as they do not have any equivalent quantifier, e.g., for all, for some, none, etc.
3. Semantic networks do not have any standard definition for the link names.
4. These networks are not intelligent and depend on the creator of the system.
In natural language processing applications like semantic parsing, word sense disambiguation, etc.
Specialized retrieval tasks, like plagiarism detection.
Knowledge Graph proposed by Google in 2012 uses semantic networks in the search engines.
There are six types of semantic networks, each having different significance in graphic representation for knowledge management and
automated reasoning:
Definitional Networks: This represents the relationship between concepts and their subtypes. Definitional networks are
fundamental in ensuring clarity and precision in knowledge representation, allowing for a clear delineation of how different
concepts relate to one another within a given domain.
Assertional Networks: It is used to assert propositions and convey factual information. These networks are particularly useful for
capturing and communicating structured information, making them a cornerstone for knowledge-based systems and databases.
Implicational Networks: They rely on implications as the primary connections between nodes, emphasizing cause-and-effect
relationships.By emphasizing causal connections, these networks are vital for predictive modeling, risk assessment, and scenario
analysis, enabling the inference of potential outcomes based on established relationships.
Executable Networks: Contain mechanisms capable of inducing changes within the network itself, allowing for dynamic
adaptations. These networks are essential for systems that require real-time decision-making, as they can autonomously modify
their structure or behavior to optimize performance or adapt to new information.
Learning Networks: These expand knowledge representations by emphasizing insights from examples and focusing on adaptive
learning. Learning networks are foundational in machine learning and AI applications, as they enable systems to continuously
improve and refine their understanding of the world through exposure to new information.
Hybrid Networks: This type of network consists of two or more of the above-mentioned techniques, either within a single network
or between closely interacting networks, to fulfill diverse knowledge representation requirements.
Frame Representation
A frame is a record like structure which consists of a
collection of attributes and its values to describe an
entity in the world. Frames are the AI data structure which
divides knowledge into substructures by representing
stereotypes situations. It consists of a collection of slots and
slot values. These slots may be of any type and sizes. Slots
have names and values which are called facets.
Slots Filters
Year 1996
Page 1152
Example 2:
Slots Filter
Name Peter
Profession Doctor
Age 25
Marital status Single
Weight 78
Advantages of frame representation:
The rules are structured in an IF-THEN format, where the IF part lists the conditions
that must be satisfied, and the THEN part describes the resulting actions or conclusions
if the conditions are met.
For example:
A rule engine sequences the rules set and applies them to the available facts from the
database. It checks which rule conditions are met based on the current facts. Once a
rule is triggered, the rule engine executes the corresponding action in the THEN part.
This inference process continues until no more rules can be matched or a final goal
state is reached. Chaining together multiple rules enables complex logic and
deductions.
Rule-based systems are commonly used in domains like diagnostics, customer service
chatbots, and business process automation. The modular structure of rules and facts
makes them interpretable, maintainable, and customizable.
The 'Fuzzy' word means the things that are not clear or are vague. Sometimes, we cannot decide in real life that
the given problem or statement is either true or false. At that time, this concept provides many values between
the true and false and gives the flexibility to find the best solution to that problem.
Fuzzy logic contains the multiple logical values and these values are the truth values of a variable or problem
between 0 and 1. This concept was introduced by Lofti Zadeh in 1965 based on the Fuzzy Set Theory. This
concept provides the possibilities which are not given by computers, but similar to the range of possibilities
generated by humans.
In the Boolean system, only two possibilities (0 and 1) exist, where 1 denotes the absolute truth value and 0
denotes the absolute false value. But in the fuzzy system, there are multiple possibilities present between the 0
and 1, which are partially false and partially true.
The Fuzzy logic can be implemented in systems such as micro-controllers, workstation-based or large network-
based systems for achieving the definite output. It can also be implemented in both hardware or software.
1. This concept is flexible and we can easily understand and implement it.
2. It is used for helping the minimization of the logics created by the human.
3. It is the best method for finding the solution of those problems which are suitable for approximate or uncertain
reasoning.
4. It always offers two values, which denote the two possible solutions for a problem and statement.
5. It allows users to build or create the functions which are non-linear of arbitrary complexity.
6. In fuzzy logic, everything is a matter of degree.
7. In the Fuzzy logic, any system which is logical can be easily fuzzified.
8. It is based on natural language processing.
9. It is also used by the quantitative analysts for improving their algorithm's execution.
10. It also allows users to integrate with the programming.
In the architecture of the Fuzzy Logic system, each component plays an important role. The architecture consists
of the different four components which are given below.
1. Rule Base
2. Fuzzification
3. Inference Engine
4. Defuzzification
1. Rule Base
Rule Base is a component used for storing the set of rules and the If-Then conditions given by the experts are
used for controlling the decision-making systems. There are so many updates that come in the Fuzzy theory
recently, which offers effective methods for designing and tuning of fuzzy controllers. These updates or
developments decreases the number of fuzzy set of rules.
2. Fuzzification
Fuzzification is a module or component for transforming the system inputs, i.e., it converts the crisp number
into fuzzy steps. The crisp numbers are those inputs which are measured by the sensors and then fuzzification
passed them into the control systems for further processing. This component divides the input signals into
following five states in any Fuzzy Logic system:
3. Inference Engine
This component is a main component in any Fuzzy Logic system (FLS), because all the information is processed
in the Inference Engine. It allows users to find the matching degree between the current fuzzy input and the
rules. After the matching degree, this system determines which rule is to be added according to the given input
field. When all rules are fired, then they are combined for developing the control actions.
4. Defuzzification
Defuzzification is a module or component, which takes the fuzzy set inputs generated by the Inference Engine,
and then transforms them into a crisp value. It is the last step in the process of a fuzzy logic system. The crisp
value is a type of value which is acceptable by the user. Various techniques are present to do this, but the user
has to select the best one for reducing the errors.
Membership Function
The membership function is a function which represents the graph of fuzzy sets, and allows users to quantify
the linguistic term. It is a graph which is used for mapping each element of x to the value between 0 and 1.
This function of Membership was introduced in the first papers of fuzzy set by Zadeh. For the Fuzzy set B, the
membership function for X is defined as: μB:X → [0,1]. In this function X, each element of set B is mapped to
the value between 0 and 1. This is called a degree of membership or membership value.
To learn about classical and Fuzzy set theory, firstly you have to know about what is set.
Set
A set is a term, which is a collection of unordered or ordered elements. Following are the various examples of a
set:
Types of Set:
1. Finite
2. Empty
3. Infinite
4. Proper
5. Universal
6. Subset
7. Singleton
8. Equivalent Set
9. Disjoint Set
Classical Set
It is a type of set which collects the distinct objects in a group. The sets with the crisp boundaries are classical
sets. In any set, each single entity is called an element or member of that set.
Any set can be easily denoted in the following two different ways:
1. Roaster Form: This is also called as a tabular form. In this form, the set is represented in the following way:
The elements in the set are enclosed within the brackets and separated by the commas.
Following are the two examples which describes the set in Roaster or Tabular form:
Example 1:
Example 2:
Set of Prime Numbers less than 50: X={2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47}.
2. Set Builder Form: Set Builder form defines a set with the common properties of an element in a set. In this
form, the set is represented in the following way:
A = {x:p(x)}
The set {2, 4, 6, 8, 10, 12, 14, 16, 18} is written as:
B = {x:2 ≤ x < 20 and (x%2) = 0}
Following are the various operations which are performed on the classical sets:
1. Union Operation
2. Intersection Operation
3. Difference Operation
4. Complement Operation
1. Union:
This operation is denoted by (A U B). A U B is the set of those elements which exist in two different sets A and
B. This operation combines all the elements from both the sets and make a new set. It is also called a Logical OR
operation.
A ∪ B = { x | x ∈ A OR x ∈ B }.
Example:
Set A = {10, 11, 12, 13}, Set B = {11, 12, 13, 14, 15}, then A ∪ B = {10, 11, 12, 13, 14, 15}
2. Intersection
This operation is denoted by (A ∩ B). A ∩ B is the set of those elements which are common in both set A and B.
It is also called a Logical OR operation.
A ∩ B = { x | x ∈ A AND x ∈ B }.
Example:
Set A = {10, 11, 12, 13}, Set B = {11, 12, 14} then A ∩ B = {11, 12}
3. Difference Operation
This operation is denoted by (A - B). A-B is the set of only those elements which exist only in set A but not in
set B.
A - B = { x | x ∈ A AND x ∉ B }.
4. Complement Operation: This operation is denoted by (A`). It is applied on a single set. A` is the set of
elements which do not exist in set A.
A′ = {x|x ∉ A}.
There are following various properties which play an essential role for finding the solution of a fuzzy logic
problem.
1. Commutative Property:
This property provides the following two states which are obtained by two finite sets A and B:
A∪B=B∪A
A∩B=B∩A
2. Associative Property:
This property also provides the following two states but these are obtained by three different finite sets A, B, and
C:
A ∪ (B ∪ C) = (A ∪ B) ∪ C
A ∩ (B ∩ C) = (A ∩ B) ∩ C
3. Idempotency Property:
This property also provides the following two states but for a single finite set A:
A∪A=A
A∩A=A
4. Absorption Property
This property also provides the following two states for any two finite sets A and B:
A ∪ (A ∩ B) = A
A ∩ (A ∪ B) = A
5. Distributive Property:
This property also provides the following two states for any three finite sets A, B, and C:
A∪ (B ∩ C) = (A ∪ B)∩ (A ∪ C)
A∩ (B ∪ C) = (A∩B) ∪ (A∩C)
6. Identity Property:
This property provides the following four states for any finite set A and Universal set X:
A ∪ φ =A
A∩X=A
A∩φ=φ
A∪X=X
7. Transitive property
This property provides the following state for the finite sets A, B, and C:
If A ⊆ B ⊆ C, then A ⊆ C
8. Ivolution property
This law gives the following rules for providing the contradiction and tautologies:
ADVERTISEMENT
Fuzzy Set
The set theory of classical is the subset of Fuzzy set theory. Fuzzy logic is based on this theory, which is a
generalisation of the classical theory of set (i.e., crisp set) introduced by Zadeh in 1965.
A fuzzy set is a collection of values which exist between 0 and 1. Fuzzy sets are denoted or represented by the
tilde (~) character. The sets of Fuzzy theory were introduced in 1965 by Lofti A. Zadeh and Dieter Klaua. In the
fuzzy set, the partial membership also exists. This theory released as an extension of classical set theory.
This theory is denoted mathematically asA fuzzy set (Ã) is a pair of U and M, where U is the Universe of
discourse and M is the membership function which takes on values in the interval [ 0, 1 ]. The universe of
discourse (U) is also denoted by Ω or X.
Given à and B are the two fuzzy sets, and X be the universe of discourse with the following respective member
functions:
Example:
For X1
For X2
For X3
For X4
Example:
then,
For X1
μA∩B(X1) = min (μA(X1), μB(X1))
μA∩B(X1) = min (0.3, 0.8)
μA∩B(X1) = 0.3
For X2
For X3
For X4
μĀ(x) = 1-μA(x),
Example:
then,
For X1
μĀ(X1) = 1-μA(X1)
μĀ(X1) = 1 - 0.3
μĀ(X1) = 0.7
For X2
μĀ(X2) = 1-μA(X2)
μĀ(X2) = 1 - 0.8
μĀ(X2) = 0.2
For X3
μĀ(X3) = 1-μA(X3)
μĀ(X3) = 1 - 0.5
μĀ(X3) = 0.5
For X4
μĀ(X4) = 1-μA(X4)
μĀ(X4) = 1 - 0.1
μĀ(X4) = 0.9
1. This theory is a class of those sets having 1. This theory is a class of those sets having un-
sharp boundaries. sharp boundaries.
2. This set theory is defined by exact 2. This set theory is defined by ambiguous
boundaries only 0 and 1. boundaries.
3. In this theory, there is no uncertainty 3. In this theory, there always exists uncertainty
about the boundary's location of a set. about the boundary's location of a set.
4. This theory is widely used in the design of 4. It is mainly used for fuzzy controllers.
digital systems.
"A Bayesian network is a probabilistic graphical model which represents a set of variables and their
conditional dependencies using a directed acyclic graph."
It is also called a Bayes network, belief network, decision network, or Bayesian model.
Bayesian networks are probabilistic, because these networks are built from a probability
distribution, and also use probability theory for prediction and anomaly detection.
Real world applications are probabilistic in nature, and to represent the relationship between
multiple events, we need a Bayesian network. It can also be used in various tasks
including prediction, anomaly detection, diagnostics, automated insight, reasoning, time
series prediction, and decision making under uncertainty.
Bayesian Network can be used for building models from data and experts opinions, and it consists
of two parts:
The generalized form of Bayesian network that represents and solve decision problems under uncertain knowledge is known as
an Influence diagram.
A Bayesian network graph is made up of nodes and Arcs (directed links), where:
o Each node corresponds to the random variables, and a variable can be continuous or discrete.
o Arc or directed arrows represent the causal relationship or conditional probabilities between random variables. These
directed links or arrows connect the pair of nodes in the graph.
These links represent that one node directly influence the other node, and if there is no directed link that means that
nodes are independent with each other
o In the above diagram, A, B, C, and D are random variables represented by the nodes of the network
graph.
o If we are considering node B, which is connected with node A by a directed arrow, then node A is called
the parent of Node B.
o Node C is independent of node A.
Note: The Bayesian network graph does not contain any cyclic graph. Hence, it is known as a directed acyclic graph or DAG.
o Causal Component
o Actual numbers
Each node in the Bayesian network has condition probability distribution P(Xi |Parent(Xi) ), which
determines the effect of the parent on that node.
Answer the questions:
1) Define fuzzy logic?
2) Define Fuzziyfication?
3) Define Inference Engine
4) Define Defuzzification
5) Explain architecture or process of a Fuzzy Logic system with diagram
6) Explain the Operations on Fuzzy Set
7) Difference between Classical Set Theory and Fuzzy Set Theory
8) Difference between forward and backward chaining with examples.
9) What is Bayesian Network? Explain how Bayesian Network represents and inference the uncertain
knowledge.
10) Represent the following sentences into a semantic network.
o Birds are animals.
o Birds have feathers, fly and lay eggs.
o Albatros is a bird.
o Donald is a bird.
o Tracy is an albatross