0% found this document useful (0 votes)
6 views

AI unit 3

The document discusses knowledge representation and reasoning in artificial intelligence, detailing types of knowledge such as declarative, procedural, meta, heuristic, and structural knowledge. It explains propositional logic and first-order logic as methods for knowledge representation, highlighting their syntax, limitations, and applications in AI. Additionally, it covers resolution, chaining techniques, and utility theory, which aids in decision-making under uncertainty by assigning subjective values to outcomes.

Uploaded by

xyz18187
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

AI unit 3

The document discusses knowledge representation and reasoning in artificial intelligence, detailing types of knowledge such as declarative, procedural, meta, heuristic, and structural knowledge. It explains propositional logic and first-order logic as methods for knowledge representation, highlighting their syntax, limitations, and applications in AI. Additionally, it covers resolution, chaining techniques, and utility theory, which aids in decision-making under uncertainty by assigning subjective values to outcomes.

Uploaded by

xyz18187
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Unit -3

Knowledge Representation and Reasoning


By:Ms Neelu Mourya

Knowledge representation
Humans are best at understanding, reasoning, and interpreting knowledge. Human
knows things, which is knowledge and as per their knowledge they perform
various actions in the real world. But how machines do all these things comes
under knowledge representation and reasoning.

What to Represent:
Following are the kind of knowledge which needs to be represented in AI systems:

o Object: All the facts about objects in our world domain. E.g., Guitars contains strings,
trumpets are brass instruments.
o Events: Events are the actions which occur in our world.
o Performance: It describe behavior which involves knowledge about how to do things.
o Meta-knowledge: It is knowledge about what we know.
o Facts: Facts are the truths about the real world and what we represent.
o 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
(Here, sentences are used as a technical term and not identical with the English
language).

Knowledge: Knowledge is awareness or familiarity gained by experiences of


facts, data, and situations. Following are the types of knowledge in artificial
intelligence:

Types of knowledge
Following are the various types of knowledge:
1. Declarative Knowledge:

o Declarative knowledge is to know about something.


o It includes concepts, facts, and objects.
o It is also called descriptive knowledge and expressed in declarative sentences.
o It is simpler than procedural language.

2. Procedural Knowledge

o It is also known as imperative knowledge.


o Procedural knowledge is a type of knowledge which is responsible for knowing how to
do something.
o It can be directly applied to any task.
o It includes rules, strategies, procedures, agendas, etc.
o Procedural knowledge depends on the task on which it can be applied.

3. Meta-knowledge:

o Knowledge about the other types of knowledge is called Meta-knowledge.

4. Heuristic knowledge:

o Heuristic knowledge is representing knowledge of some experts in a filed or subject.


o Heuristic knowledge is rules of thumb based on previous experiences, awareness of
approaches, and which are good to work but not guaranteed.

5. Structural knowledge:

o Structural knowledge is basic knowledge to problem-solving.


o It describes relationships between various concepts such as kind of, part of, and grouping
of something.
o It describes the relationship that exists between concepts or objects.

Types of Knowledge Representation


i) Propositional Logic
ii) First order Predicate logic

Propositional logic in Artificial intelligence


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.

Example:
1. a) It is Sunday.
2. b) The Sun rises from West (False proposition)
3. c) 3+3= 7(False proposition)
4. d) 5 is a prime number.
Syntax of propositional logic:
The syntax of propositional logic defines the allowable sentences for the
knowledge representation. There are two types of Propositions:

a.Atomic Propositions

b.Compound propositions

o 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.

Example:

1. a) 2+2 is 4, it is an atomic proposition as it is a true fact.


2. b) "The Sun is cold" is also a proposition as it is a false fact.
o Compound proposition: Compound propositions are constructed by
combining simpler or atomic propositions, using parenthesis and logical
connectives.

Example:

1. a) "It is raining today, and street is wet."


2. b) "Ankit is a doctor, and his clinic is in Mumbai."

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:

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,

3. Disjunction: A sentence which has ∨ connective, such as P ∨ Q. is called


Q= Rohan is hardworking. → P𝖠 Q.

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
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.
Following is the summarized table for Propositional Logic
Connectives:

Limitations of Propositional logic:


o We cannot represent relations like ALL, some, or none with propositional logic. Example:
a. All the girls are intelligent.
b. Some apples are sweet.
o Propositional logic has limited expressive power.
o In propositional logic, we cannot describe statements in terms of their properties or
logical relationships.

First-Order Logic in Artificial intelligence


In the topic of Propositional logic, we have seen that how to represent statements
using propositional logic. But unfortunately, in propositional logic, we can only
represent the facts, which are either true or false. PL is not sufficient to represent
the complex sentences or natural language statements. The propositional logic has
very limited expressive power. Consider the following sentence, which we cannot
represent using PL logic

o Some humans are intelligent", or


o "Sachin likes cricket."

To represent the above statements, PL logic is not sufficient, so we required some


more powerful logic, such as first-order logic.
First-Order logic:
o First-order logic is another way of knowledge representation in artificial intelligence. It is
an extension to propositional logic.
o FOL is sufficiently expressive to represent the natural language statements in a concise
way.
o First-order logic is also known as Predicate logic or First-order predicate logic. First-
order logic is a powerful language that develops information about the objects in a more
easy way and can also express the relationship between those objects.
o First-order logic (like natural language) does not only assume that the world contains
facts like propositional logic but also assumes the following things in the world:
o Objects: A, B, people, numbers, colors, wars, theories, squares, pits, wumpus, ......
o Relations: It can be unary relation such as: red, round, is adjacent, or n-any
relation such as: the sister of, brother of, has color, comes between
o Function: Father of, best friend, third inning of, end of, ......
o As a natural language, first-order logic also has two main parts:
a. Syntax
b. Semantics

Syntax of First-Order logic:


The syntax of FOL determines which collection of symbols is a logical expression
in first-order logic. The basic syntactic elements of first-order logic are symbols.
We write statements in short-hand notation in FOL.

Basic Elements of First-order logic:


Following are the basic elements of FOL syntax:t

Constant 1, 2, A, John, Mumbai, cat,....

Variables x, y, z, a, b,....

Predicates Brother, Father, >,....


Function sqrt, LeftLegOf, ....

Connectives 𝖠, ∨, ¬, ⇒, ⇔

Equality ==

Quantifier ∀, ∃

Atomic sentences:
o Atomic sentences are the most basic sentences of first-order logic. These sentences are
formed from a predicate symbol followed by a parenthesis with a sequence of terms.
o We can represent atomic sentences as Predicate (term1, term2,......, term n).

Example: Ravi and Ajay are brothers: => Brothers(Ravi, Ajay).


Chinky is a cat: => cat (Chinky).

Complex Sentences:
o Complex sentences are made by combining atomic sentences using connectives.

Quantifiers in First-order logic:


o A quantifier is a language element which generates quantification, and quantification
specifies the quantity of specimen in the universe of discourse.
o These are the symbols that permit to determine or identify the range and scope of the
variable in the logical expression. There are two types of quantifier:
a. Universal Quantifier, (for all, everyone, everything)
b. Existential quantifier, (for some, at least one).

Resolution in FOL
Resolution
Resolution is a theorem proving technique that proceeds by building refutation
proofs, i.e., proofs by contradictions. It was invented by a Mathematician John
Alan Robinson in the year 1965.
Resolution is used, if there are various statements are given, and we need to prove
a conclusion of those statements. Unification is a key concept in proofs by
resolutions. Resolution is a single inference rule which can efficiently
operate on the conjunctive normal form or clausal form.

Clause: Disjunction of literals (an atomic sentence) is called a clause. It is also


known as a unit clause.

Conjunctive Normal Form: A sentence represented as a conjunction of clauses is


said to be conjunctive normal form or CNF.

Example:
a. John likes all kind of food.
b. Apple and vegetable are food
c. Anything anyone eats and not killed is food.
d. Anil eats peanuts and still alive
e. Harry eats everything that Anil eats.
Prove by resolution that:
f. John likes peanuts.

Step-1: Conversion of Facts into FOL

In the first step we will convert all the given statements into its first order logic.

Chaining
Chaining is referred to as generating a statement or to coming to a
conclusion, based on the existing knowledge or facts.

It is just like connecting dots which leads to a conclusion in a forward or


backward fashion.

There are 2 types of chaining:

1. Forward Chaining

2. Backward Chaining

Before explaining the chaining I would like to first explain the


preprocessing which we need to apply on the given sentences in order to
apply any of the above mentioned chaining, and the preprocessing is:

1. Convert the sentences into Predicate Logic/ First Order


Predicate Logic.

2. Separate facts from those generated sentences.

3. Take a note of what we have to prove finally.

All the above steps for preprocessing are explained below with an
example!
Example Statements:

 John likes all kinds of food.

 Apples are food.

 Dosa is food.

 Anything anyone eats and isn’t killed-by is a food.

 Bill eats peanuts and is still alive.

 Sue eats everything Bill eats.

We have to Prove that: “John Like Peanuts”

Conversion into Predicate Logic:

Important Note: Make sure the order of x and y matches logically in


each of the statement.

1st statement can be written as: ∀x Food(x) -> Likes(John, x)

2nd statement can be written as: Food(Apple)

3rd statement can be written as: Food(Dosa)

4th statement can be written as: ∀x ∀y Eats(x, y) ^ ¬ Killed(y) -> Food(x)


5th statement can be written as: Eats(Peanuts, Bill) -> ¬ Killed(Bill)

6th statement can be written as: ∀x Eats(x, Bill) -> Eats(x, Sue)

Separation of Facts

From the above generated formulas, facts(which do not implies to


anything) are:

 Food(Apple)

 Food(Dosa)

 Eats(Peanuts, Bill) -> ¬ Killed(Bill)

To Prove

“John Like Peanuts”

Now, I will explain both type of the chaining and solve the above
example in each of them.

Forward Chaining:
Here, if we have a fact “M”, and “M” -> “N”, then we take “N” also as a
fact, or we can say we conclude “N”.

For example, consider the statements:


1. “Aarohi is studying” <- Fact “M”

2. “If Aarohi study then she achieve 1st rank in the exam” <- Fact
“M” implies “N”

From the above statements, we can easily conclude that “Aarohi


achieved 1st rank in the exam”.

Solution of the above listed example(the big one):

1. With the use of generated fact number 3, i.e Eats(Peanuts, Bill) ->
¬ Killed(Bill), we can easily conclude that Food(Peanuts), from the
4th formula generated above.

2. From Food(Peanuts), we can easily conclude that


Likes(John, Peanuts), with the use of 1st formula generated.

Hence Proved.

Backward Chaining
Here, we do just opposite of the forward chaining, i.e we have a
fact/conclusion “N”, we find a fact “M -> N” and considers “M” as a
fact.

For example, consider the statements:

1. “Aarohi achieved 1st rank in exam” <- Fact “N”


2. “If Aarohi study then she achieve 1st rank in the exam” <- Fact
“M” implies “N”

From the above statements, we can easily conclude that “Aarohi


studied”.

Solution of the above listed example(the big one):

1. We have to consider the statement we have to prove, to be a fact,


i.e. Likes(John, Peanuts) is true now.

2. From 1st formula, we can derive that Food(Peanuts) is true.

3. From 4th formula, we can derive Eats(Peanuts, John) ->


¬ Killed(John), is true.

Now, as we ended up with all the statements as true, so proved that the
statement we wanted to prove is a valid statement.

Hence Proved.
What is Utility Theory?

Utility theory in artificial intelligence is a mathematical framework used to


model decision-making under uncertainty. It allows one to assign subjective
values or preferences to different outcomes and helps make optimal choices
based on these values. Utility theory is widely used in various AI applications
such as game theory, economics, robotics, and recommendation systems,
among others.

At its core, utility theory helps AI systems make decisions that maximize a specific
goal, referred to as utility. The concept of utility is subjective and varies from
person to person or from system to system. It represents the degree of satisfaction
associated with different outcomes. For example, in a recommendation system,
the utility could describe the level of user satisfaction with a particular
recommendation. In a robotics application, a utility could represent the cost or
risk of different actions.

Utility theory also provides a way to model decisions in uncertain or


probabilistic environments, where the outcomes are associated with different
probabilities. For example, in a game of poker, the utility of a particular action
may depend on the probabilities of different cards being dealt to the player. We
can use the utility function to calculate the expected utility of each action, which is
the average utility weighted by the corresponding probabilities. The AI system can
then choose the action with the highest expected utility.

What is Utility Function?


A utility function is a mathematical function used in Artificial Intelligence (AI) to
represent a system's preferences or objectives. It assigns a numerical value,
referred to as utility, to different outcomes based on their satisfaction level. The
utility function is a quantitative measure of the system's subjective preferences.
It is used to guide decision-making in AI systems. An agent or system typically
defines the utility function based on its goals, objectives, and preferences. It
maps different outcomes to their corresponding utility values, where higher utility
values represent more desirable outcomes. The utility function is subjective and
can vary from one agent or system to another, depending on the specific context or
domain of the AI application.

Utility theory
Utility theory in artificial intelligence provides a formal framework for reasoning
about decision-making under uncertainty. It is often used in AI systems to model
decision-making in situations where outcomes are uncertain or probabilistic, and
the AI system needs to make choices based on its preferences or subjective
values.

Lottery

To understand the concept of utility theory in artificial intelligence, let's consider a


simple example of a lottery. Suppose you are given the option to play a lottery
with two choices:

1. A guaranteed prize of $$100$


2. A 50% chance of winning $$200$ and a 50% chance of winning nothing

Which option would you choose? Your decision depends on your risk
tolerance, financial situation, and personal preferences. Utility theory provides
a way to model and quantify these preferences mathematically using a utility
function.

Probabilistic reasoning:
Probabilistic reasoning is a way of knowledge representation where we apply the
concept of probability to indicate the uncertainty in knowledge. In probabilistic
reasoning, we combine probability theory with logic to handle the uncertainty.

We use probability in probabilistic reasoning because it provides a way to handle


the uncertainty that is the result of someone's laziness and ignorance.

In the real world, there are lots of scenarios, where the certainty of something is
not confirmed, such as "It will rain today," "behavior of someone for some
situations," "A match between two teams or two players." These are probable
sentences for which we can assume that it will happen but not sure about it, so here
we use probabilistic reasoning.

Need of probabilistic reasoning in AI:

o When there are unpredictable outcomes.


o When specifications or possibilities of predicates becomes too large to handle.
o When an unknown error occurs during an experiment.

In probabilistic reasoning, there are two ways to solve problems with uncertain
knowledge:

o Bayes' rule
o Bayesian Statistics

o What are Hidden Markov Models?


o A Hidden Markov Model (HMM) is a probabilistic model that consists of
a sequence of hidden states, each of which generates an observation.
The
hidden states are usually not directly observable, and the goal of HMM is to
estimate the sequence of hidden states based on a sequence of observations.
An HMM is defined by the following components:
o A set of N hidden states, S = {s1, s2, ..., sN}.
o A set of M observations, O = {o1, o2, ..., oM}.
o An initial state probability distribution, ? = {?1, ?2, ..., ?N}, which specifies the
probability of starting in each hidden state.
o A transition probability matrix, A = [aij], defines the probability of moving from one
hidden state to another.
o An emission probability matrix, B = [bjk], defines the probability of emitting an
observation from a given hidden state.

The basic idea behind an HMM is that the hidden states generate the observations,
and the observed data is used to estimate the hidden state sequence. This is often
referred to as the forward-backwards algorithm.

Applications of Hidden Markov Models


Now, we will explore some of the key applications of HMMs, including speech
recognition, natural language processing, bioinformatics, and finance.

Speech Recognition

Natural Language Processing

Bioinformatics
Finance

Bayesian Belief Network in artificial intelligence


Bayesian belief network is key computer technology for dealing with probabilistic
events and to solve a problem which has uncertainty. We can define a Bayesian
network as:

"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.

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.

The Bayesian network has mainly two components:

o Causal Component
o Actual numbers

Explanation of Bayesian network:


Let's understand the Bayesian network through an example by creating a directed
acyclic graph:

Example: Harry installed a new burglar alarm at his home to detect burglary. The
alarm reliably responds at detecting a burglary but also responds for minor
earthquakes. Harry has two neighbors David and Sophia, who have taken a
responsibility to inform Harry at work when they hear the alarm. David always
calls
Harry when he hears the alarm, but sometimes he got confused with the phone
ringing and calls at that time too. On the other hand, Sophia likes to listen to high
music, so sometimes she misses to hear the alarm. Here we would like to compute
the probability of Burglary Alarm.

Problem:

Calculate the probability that alarm has sounded, but there is neither a
burglary, nor an earthquake occurred, and David and Sophia both called the
Harry.

Solution:

o The Bayesian network for the above problem is given below. The network
structure is showing that burglary and earthquake is the parent node of the
alarm and directly affecting the probability of alarm's going off, but David
and Sophia's calls depend on alarm probability.
o The network is representing that our assumptions do not directly perceive
the burglary and also do not notice the minor earthquake, and they also not
confer before calling.
o The conditional distributions for each node are given as conditional
probabilities table or CPT.
o Each row in the CPT must be sum to 1 because all the entries in the table
represent an exhaustive set of cases for the variable.
o In CPT, a boolean variable with k boolean parents contains 2 K probabilities.
Hence, if there are two parents, then CPT will contain 4 probability values

List of all events occurring in this network:

o Burglary (B)
o Earthquake(E)
o Alarm(A)
o David Calls(D)
o Sophia calls(S)
o We can write the events of problem statement in the form of probability:
P[D, S, A, B, E], can rewrite the above probability statement using joint
probability distribution:
o P[D, S, A, B, E]= P[D | S, A, B, E]. P[S, A, B, E]
o =P[D | S, A, B, E]. P[S | A, B, E]. P[A, B, E]
o = P [D| A]. P [ S| A, B, E]. P[ A, B, E]
o = P[D | A]. P[ S | A]. P[A| B, E]. P[B, E]
o = P[D | A ]. P[S | A]. P[A| B, E]. P[B |E]. P[E]

The semantics of Bayesian Network:


o There are two ways to understand the semantics of the Bayesian network,
which is given below:
o 1. To understand the network as the representation of the Joint
probability distribution.
o It is helpful to understand how to construct the network.
o 2. To understand the network as an encoding of a collection of conditional
independence statements.
o It is helpful in designing inference procedure.

THANKU

ASSIST PROFF :Ms Neelu Mourya

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy