0% found this document useful (0 votes)
14 views20 pages

Unit 3

Knowledge Representation: Knowledge-Based Agents, Logic, Propositional Logic: A Very Simple Logic, Ontological Engineering, Categories and Objects, Events, Mental Events and Mental Objects, Reasoning Systems for Categories, The Internet Shopping World.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views20 pages

Unit 3

Knowledge Representation: Knowledge-Based Agents, Logic, Propositional Logic: A Very Simple Logic, Ontological Engineering, Categories and Objects, Events, Mental Events and Mental Objects, Reasoning Systems for Categories, The Internet Shopping World.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 20

UNIT-3 AI

Knowledge Representation: Knowledge-Based Agents, Logic, Propositional Logic: A Very


Simple Logic, Ontological Engineering, Categories and Objects, Events, Mental Events and
Mental Objects, Reasoning Systems for Categories, The Internet Shopping World.

3.1 Knowledge-Based Agents


 An intelligent agent needs knowledge about the real world for taking decisions and reasoning
to act efficiently.
 A knowledge-based agent must able to do the following:
1) An agent should be able to represent states, actions, etc.
2) An agent Should be able to incorporate new percepts
3) An agent can update the internal representation of the world
4) An agent can deduce the internal representation of the world
5) An agent can deduce appropriate actions.
 The architecture of knowledge-based agent:

 The knowledge-based agent (KBA) take input from the environment by perceiving the
environment. The input is taken by the inference engine of the agent and which also
communicate with KB to decide as per the knowledge store in KB. The learning element of
KBA regularly updates the KB by learning new knowledge.

1
UNIT-3 AI

 Knowledge-base is required for updating knowledge for an agent to learn with experiences
and take action as per the knowledge.
 Knowledge-based agents are composed of two main parts:
1) Knowledge-base and
2) Inference system.
Knowledge base:
 Knowledge-base (KB) is a central component of a knowledge-based agent, and it is a
collection of sentences (here 'sentence' is a technical term and it is not identical to sentence in
English).
 These sentences are expressed in a language which is called a knowledge representation
language.
Inference system
 Inference means deriving new sentences from old.
 Inference system allows us to add a new sentence to the knowledge base.
 A sentence is a proposition about the world.
 Inference system applies logical rules to the KB to deduce new information.
 Inference system generates new facts so that an agent can update the KB.
 An inference system works mainly in two rules which are given as:
1) Forward chaining
2) Backward chaining
 Following is the structure outline of a generic knowledge-based agents program:
function KB-AGENT(percept):
persistent: KB, a knowledge base t, a counter, initially 0, indicating time
TELL(KB, MAKE-PERCEPT-SENTENCE(percept, t))
Action = ASK(KB, MAKE-ACTION-QUERY(t))
TELL(KB, MAKE-ACTION-SENTENCE(action, t))
t=t+1
return action

2
UNIT-3 AI

 The knowledge-based agent takes percept as input and returns an action as output.
 The agent maintains the knowledge base, KB, and it initially has some background
knowledge of the real world.
 It also has a counter to indicate the time for the whole process, and this counter is initialized
with zero.
 Each time when the function is called, it performs its three operations:
1) Firstly it TELLs the KB what it perceives.
2) Secondly, it asks KB what action it should take
3) Third agent program TELLS the KB that which action was chosen.
 The MAKE-PERCEPT-SENTENCE generates a sentence as setting that the agent perceived
the given percept at the given time.
 The MAKE-ACTION-QUERY generates a sentence to ask which action should be done at
the current time.
 MAKE-ACTION-SENTENCE generates a sentence which asserts that the chosen action was
executed.

Various levels of knowledge-based agent:


1. Knowledge level
In this level, we need to specify what the agent knows, and what the agent goals are. With these
specifications, we can fix its behavior.
2. Logical level:
At this level, we understand that how the knowledge representation of knowledge is stored. At
this level, sentences are encoded into different logics.
3. Implementation level:
This is the physical representation of logic and knowledge. At the implementation level agent
perform actions as per logical and knowledge level.

3
UNIT-3 AI

Approaches to designing a knowledge-based agent:


There are mainly two approaches to build a knowledge-based agent:
1. Declarative approach:
We can create a knowledge-based agent by initializing with an empty knowledge base and telling
the agent all the sentences with which we want to start with. This approach is called Declarative
approach.
2. Procedural approach:
In the procedural approach, we directly encode desired behavior as a program code.
3.2 Logic
 This concept summarizes the fundamental concepts of logical representation and reasoning.
 We know that knowledge bases consist of sentences. These sentences are expressed
according to the syntax of the representation language, which specifies all the sentences that
are well formed. The intention of syntax is clear enough in ordinary arithmetic, “x + y = 4” is
a well-formed sentence, whereas “x4y+ =” is not.
 A logic must also define the semantics or meaning of sentences. The semantics defines the
truth of each sentence with respect to each possible world. For example, the semantics for
arithmetic specifies that the sentence “x + y =4” is true in a world where x is 2 and y is 2, but
false in a world where x is 1 and y is 1.
 In standard logics, every sentence must be either true or false in each possible world.
 When we need to be precise, we use the term model in place of “possible world.”
 Models are mathematical abstractions, each of which simply fixes the true or false of every
relevant sentence.
 If a sentence α is true in model m, we say that m satisfies α or sometimes m is a model of α.
We use the notation M(α) to mean the set of all models of α.
 logical reasoning involves the relation of logical entailment (involving by consequence)
between sentences—the idea that a sentence follows logically from another sentence. In
mathematical notation, we write α |= β to mean that the sentence α entails the sentence β.
 The formal definition of entailment is α |= β if and only if, in every model in which α is true,
β is also true. We can write α |= β if and only if M(α) ⊆ M(β) .

4
UNIT-3 AI

 An inference algorithm that derives only entailed sentences is called sound or truth
preserving.
 The property of completeness is also desirable: an inference algorithm is complete if it can
derive any sentence that is entailed.
 The final issue to consider is grounding—the connection between logical reasoning
processes and the real environment in which the agent exists. A simple answer is that the
agent’s sensors create the connection.

3.3 Propositional Logic: A very simple logic


 Propositional logic (PL) is the simplest form of logic where all the statements are made by
propositions.
 A proposition is a declarative statement which is either true or false.
 It is a technique of knowledge representation in logical and mathematical form.
 Examples:
a) It is Sunday.
b) The Sun rises from West (False proposition)
c) 3+3= 7(False proposition)
d) 5 is a prime number.
Syntax:
 The syntax of propositional logic defines the allowable sentences for the knowledge
representation.
 There are two types of Propositions:
1. Atomic Propositions or Atomic sentences
2. Compound propositions or Complex sentence
 Atomic Proposition: Atomic propositions are the simple propositions. It consists of a single
proposition symbol. These are the sentences which must be either true or false.
Examples:
a) 2+2 is 4, it is an atomic proposition as it is a true fact.
b) "The Sun is cold" is also a proposition as it is a false fact.

5
UNIT-3 AI

 Compound proposition: Compound propositions are constructed by combining simpler or


atomic propositions, using parenthesis and logical connectives.
Examples:
a) "It is raining today, and street is wet."
b) "Ankit is a doctor, and his clinic is in Mumbai."
 Propositional logic is also called Boolean logic as it works on 0 and 1.
 In propositional logic, we use symbolic variables to represent the logic, and we can use any
symbol for a representing a proposition, such A, B, C, P, Q, R, etc.
 Propositions can be either true or false, but it cannot be both.
Logical Connectives:
1. Negation:
A sentence such as ¬ P is called negation of P. A literal can be either Positive literal or negative
literal.
2. Conjunction:
A sentence which has ∧ connective such as, P ∧ Q is called a conjunction.
Example: Rohan is intelligent and hardworking. It can be written as,
P= Rohan is intelligent,
Q= Rohan is hardworking. → P∧ Q.
3. Disjunction:
A sentence which has ∨ connective, such as P ∨ Q. is called disjunction, where P and Q are the
propositions.
Example: "Ritika is a doctor or Engineer",
Here P= Ritika is Doctor. Q= Ritika is Doctor, so we can write it as P ∨ Q.
4. Implication:
A sentence such as P → Q, is called an implication. Implications are also known as if-then rules.
It can be represented as
If it is raining, then the street is wet.
Let P= It is raining, and Q= Street is wet, so it is represented as P → Q

6
UNIT-3 AI

5. Biconditional:
A sentence such as P⇔ Q is a Biconditional sentence, example If I am breathing, then I am alive
P= I am breathing, Q= I am alive, it can be represented as P ⇔ Q.
 A BNF (Backus–Naur Form) grammar of sentences in propositional logic, along with
operator precedence, from highest to lowest is given below.
Sentence → AtomicSentence | ComplexSentence
AtomicSentence → True | False | P | Q | R | . . .
ComplexSentence → ( Sentence ) | [ Sentence ]
| ¬Sentence
| Sentence ∧ Sentence
| Sentence ∨ Sentence
| Sentence ⇒ Sentence
| Sentence ⇔ Sentence
OPERATOR PRECEDENCE : ¬, ∧, ∨,⇒,⇔
 The BNF grammar by itself is ambiguous; a sentence with several operators can be parsed
(verified) by the grammar in multiple ways. To eliminate the ambiguity, we define a
precedence for each operator.
Semantics:
 The semantics defines the rules for determining the truth of a sentence with respect to a
particular model. In propositional logic, a model simply fixes the truth value—true or false—
for every proposition symbol.
 The semantics for propositional logic must specify how to compute the truth value of any
sentence.
 All sentences are constructed from atomic sentences and the five connectives.
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.

7
UNIT-3 AI

Following are the truth tables for all logical connectives:

8
UNIT-3 AI

3.4 Ontological Engineering


 Ontology engineering is a set of tasks related to the development of ontologies for a
particular domain. (OR) a set of concepts and categories in a subject area or domain that
shows their properties and the relations between them.
 How to create more general and flexible representations – Concepts like actions, time,
physical objects and beliefs. Representing these abstract concepts is sometimes called
ontological engineering.
 Define general framework of concepts called as upper ontology with general concepts at the
top and more specific concepts below the hierarchy.

9
UNIT-3 AI

 Defining terms in the domain and relations among them


– Defining concepts in the domain(classes)
– Arranging the concepts in a hierarchy(subclass-superclass hierarchy)
– Defining which attributes and properties classes can have and constraints on their values
– Defining individuals and filling in property values
 Two major characteristics of general-purpose ontologies distinguish them from collections of
s pecial-purpose ontologies:
1. A general-purpose ontology should be applicable in more or less any special-purpose
domain (with the addition of domain-specific axioms).
2. In any sufficiently demanding domain, different areas of knowledge must be unified,
because reasoning and problem solving could involve several areas simultaneously.
3.5 Categories and Objects
 KR requires the organization of objects into categories.
 Categories play a role in predictions about objects based on perceived properties.
 Categories can be represented in two ways by FOL (First Order Logic)
1. Predicates: apple(x)
2. Reification (act of changing abstract to real) of categories into objects: apples
 Category is a set of its members
– Example: Member(x, apples), x ∈ apples,
– Subset(apples, fruits), apples ⊂ fruits
Category Organization:
 Categories serve to organize and simplify the knowledge base through inheritance.
 Relation = inheritance:
– All instance of food are edible (eatable), fruit is a subclass of food and apples is a subclass of
fruit then an apple is edible.
– Individual apples inherit the property of edibility from food
 Subclass relations organize categories into taxonomy (classification) or taxonomy hierarchy.
FOL and Categories:

10
UNIT-3 AI

 First-order logic makes it easy to state facts about categories, either by relating objects to
categories or by quantifying over their members.
Examples:
1. An object is a member of a category
MemberOf(BB12,Basketballs)

2. A category is a subclass of another category


SubsetOf(Basketballs, Balls)
3. All members of a category have some properties
∀ x (MemberOf(x, Basketballs) ⇒ Round(x))
4. All members of a category can be recognized by some properties
∀ x (Orange(x) ∧ Round(x) ∧ Diameter(x)=9.5in ∧ MemberOf(x,Balls) ⇒
MemberOf(x, BasketBalls))
5. A category as a whole has some properties
MemberOf(Dogs, DomesticatedSpecies)
Relations between Categories:
 Two or more categories are disjoint if they are mutually exclusive.
Disjoint({Animals, Vegetables})
 A decomposition of a class into categories is called exhaustive (fully comprehensive) if each
object of the class must belong to at least one category
living = {animal, vegetable, fungi, bacteria}
 A partition is an exhaustive decomposition of a class into disjoint subsets.
student = {undergraduate, graduate}
Natural kinds:
 Many categories have no clear-cut definitions (e.g., chair, bush, book).
Tomatoes: sometimes green, orange, red, yellow. Mostly spherical, smaller, larger etc
Solution: ∀ x, x ∈ Typical(Tomatoes) ⇒ Red(x) ∧ Spherical(x)
 This helps us to write down useful facts about categories without providing exact definitions.
Physical composition:

11
UNIT-3 AI

 One object may be part of another:


– PartOf(Guntur,Andhrapradesh)
– PartOf(Andhrapradesh, India)
– PartOf(India,Asia)
The PartOf predicate is transitive (and reflexive), so we can infer that
PartOf(India,Asia)
 More generally:
∀ x PartOf(x,x)
∀ x,y,z PartOf(x,y) ∧ PartOf(y,z) ⇒ PartOf(x,z)
Logical Minimization: Defining an object as the smallest one satisfying certain conditions.
Measurements:
• Objects have height, mass, cost. Values that we assign to these properties are called
measures.
• Combine Unit functions with a number to measure line segment object L1
Length(L1) = Inches(1.5) = Centimeters(3.81).

3.6 Events, Mental Events and Mental Objects, Reasoning Systems for Categories
What is Knowledge Representation?
 Knowledge Representation in AI describes the representation of knowledge. Basically, it is a
study of how the beliefs, intentions, and judgments of an intelligent agent can be expressed
suitably for automated reasoning.
 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.
What to Represent:
 Following are the kind of knowledge which needs to be represented in AI systems:
1. Object: All the facts about objects in our world domain.

12
UNIT-3 AI

2. Events: Events are the actions which occur in our world.


3. Performance: It describes behavior which involves knowledge about how to do things.
4. Meta-knowledge: It is knowledge about what we know.
5. Facts: Facts are the truths about the real world and what we represent.
6. Knowledge-Base: The central component of the knowledge-based agents is the
knowledge base. It is represented as KB. The Knowledgebase is a group of the Sentences
Types of knowledge

1) Declarative Knowledge – It includes concepts, facts, and objects and expressed in a


declarative sentence.
2) Structural Knowledge – It is a basic problem-solving knowledge that describes the
relationship between concepts and objects.
3) Procedural Knowledge – This is responsible for knowing how to do something and includes
rules, strategies, procedures, etc.
4) Meta Knowledge – Meta Knowledge defines knowledge about other types of Knowledge.

13
UNIT-3 AI

5) Heuristic Knowledge – This represents some expert knowledge in the field or subject.

AI knowledge cycle:
An Artificial intelligence system has the following components for displaying intelligent
behavior:
1) Perception
2) Learning
3) Knowledge Representation and Reasoning
4) Planning
5) Execution

 AI system has Perception component by which it retrieves information from its environment.
It can be visual, audio or another form of sensory input.
 The learning component is responsible for learning from data captured by Perception
comportment.

14
UNIT-3 AI

 In the complete cycle, the main components are knowledge representation and Reasoning.
These two components are involved in showing the intelligence in machine-like humans.
These two components are independent with each other but also coupled together.
 The planning and execution depend on analysis of Knowledge representation and reasoning.

Approaches or Techniques of knowledge representation


There are mainly four approaches or techniques of knowledge representation which are given as
follows:
1) Logical Representation or Simple relational knowledge
2) Semantic Network Representation or Inheritable knowledge
3) Frame Representation or Inferential knowledge
4) Production Rules or Procedural knowledge

1. Logical Representation
 Logical representation is a language with some definite rules which deals with propositions
and has no ambiguity in representation.

15
UNIT-3 AI

 Logical representation means drawing a conclusion based on various conditions. This


representation put 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:
 Syntaxes are the rules which decide how we can construct legal sentences in the logic.
 It determines which symbol we can use in knowledge representation.
 How to write those symbols.
Semantics:
 Semantics are the rules by which we can interpret the sentence in the logic.
 Semantic also involves assigning a meaning to each sentence.
Advantages of logical representation:
1) It enables us to do logical reasoning.
2) It is the basis for the programming languages.
Disadvantages of logical Representation:
1) Logical representations have some restrictions and are challenging to work with.
2) This technique may not be very natural, and inference may not be so efficient.

2. Semantic Network Representation


 Semantic networks work as an alternative of predicate logic for knowledge representation.
 In Semantic networks, you can represent your knowledge in the form of graphical networks.
 This network consists of nodes representing objects and arcs which describe the relationship
between those objects. Also, it categorizes the object in different forms and links those
objects.
 This representation consist of two types of relations:
1) IS-A relation (Inheritance)
2) Kind-of-relation

16
UNIT-3 AI

Advantages:
1) Semantic networks are a natural representation of knowledge.
2) Also, it conveys meaning in a transparent manner.
3) These networks are simple and easy to understand.
Disadvantages:
1) Semantic networks take more computational time at runtime.
2) Also, these are inadequate as they do not have any equivalent quantifiers.
3) These networks are not intelligent and depend on the creator of the system.
.
3. Frame Representation
 A frame is a record like structure that consists of a collection of attributes and values to
describe an entity in the world.
 These are the AI data structure that divides knowledge into substructures.
 Basically, it consists of a collection of slots and slot values of any type and size.
Advantages:
1) It makes the programming easier by grouping the related data.
2) Frame representation is easy to understand and visualize.
3) It is very easy to add slots for new attributes and relations.
4) Also, it is easy to include default data and search for missing values.

17
UNIT-3 AI

Disadvantages:
1) In frame system inference, the mechanism cannot be easily processed.
2) The inference mechanism cannot be smoothly proceeded by frame representation.
3) It has a very generalized approach.

4. Production Rules
In production rules, agent checks for the condition and if the condition exists then
production rule executes and corresponding action is carried out. The condition part of the rule
determines which rule may be applied to a problem, whereas the action part carries out the
associated problem-solving steps. This complete process is called a recognize-act cycle.

The production rules system consists of three main parts:


 The set of production rules
 Working Memory
 The recognize-act-cycle
Advantages:
1) The production rules are expressed in natural language.
2) The production rules are highly modular and can be easily removed or modified.
Disadvantages:
1) It does not exhibit any learning capabilities and does not store the result of the problem for
future uses.
2) During the execution of the program, many rules may be active. Thus, rule-based production
systems are inefficient.

3.7 The Internet Shopping World


 Artificial Intelligence is Changing the Face of Online Shopping.
 Specifically, it’s driving a change in two areas – search and customer service.

18
UNIT-3 AI

 Advancements in AI (Artificial Intelligence) like deep learning and machine learning


combined with the rise in mobile commerce are now being put to use by retailers and e-
commerce sites such as Amazon to improve the lives of online consumers.
Top Ways AI is revolutionizing the Online-Shopping/E-commerce Trends
1. Voice Assistants
Google’s Alexa, Apple’s Siri can be your personal shopping assistants in the home. The
technology can be integrated into smartphones or smart speakers specifically designed for voice
communication. You just need to say- Alexa buy this for me. And let the Alexa shop for you at
the cheapest price.
2. Creating Customer-Centric Visual Search
NLP or natural language process to contextualize and improve the search result. Not only
this, but AI uses visual search capabilities that tend to match the product.
3. ChatBots – ( It is a computer program that simulates and processes human conversation
(either written or spoken),
The only reason why e-commerce industry is able to offer 24*7 assistance is because of
chatbots. These bots tend to offer the customers with all the possible solutions and answers that
they tend to deal with.
4. Personalization
Personalization is the ability to use mass — consumer and the data to customize content
and web interface.
5. Providing Recommendation to the Customers
It tends to gather all the data that has been searched and look for. We are aware of this
thing that AI can effectively and efficiently predict customer behaviour and their needs that
offers relevant and helpful recommendations.
6. Automation
Artificial intelligence tends to use the technology and algorithm and tell the respective
retailers that what are their customer exactly looking for. As the e-commerce industry continues
to grow and expand automation becomes a must for every industry.
7. Sales Forecasting

19
UNIT-3 AI

Having the data on when the product would be sold would provide the customer with the idea on
the inventory that they need to stock up again.
8. Filtering Fake Reviews
Fake reviews have always been one of the biggest problems for online retailers and e-
commerce brands. According to research by search engine, about 88% of the consumer trust
online reviews as much as they trust a personal recommendation. Therefore, to fight this, most of
the e-commerce brands use artificial intelligence to eradicate these fake reviews and help
customers with authentic comments on the product or brand.
9. Intelligent Searches
AI can make your search engine smarter. AI-powered search engines track your browsing
patterns and do searches as per that to help you find exactly what you are looking for. With deep
learning, AI-powered search-engines pull information from big data.
10. Retargeting Potential Customers with AI
Sometimes, while managing the ad campaigns, you will notice that the customer spends a
notable amount of time on a particular product and then suddenly exit. Usually, that information
will be stored for use upon their next visit.
Well, the face of sales is changing with businesses responding directly to the customer.
Now companies are reading the minds of customers.
11. Enhance Cybersecurity
The biggest threat to eCommerce platforms is that how to keep their customer data secure
at their site.With the integration of AI and deep learning into security solutions, eCommerce
platforms can keep the criminals at the bay of the store and customer data will remain safe in the
database.

20

You might also like