AI unit 3
AI unit 3
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).
Types of knowledge
Following are the various types of knowledge:
1. Declarative Knowledge:
2. Procedural Knowledge
3. Meta-knowledge:
4. Heuristic knowledge:
5. Structural knowledge:
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
Example:
Example:
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:
Variables x, y, z, a, b,....
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).
Complex Sentences:
o Complex sentences are made by combining atomic sentences using connectives.
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.
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.
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.
1. Forward Chaining
2. Backward Chaining
All the above steps for preprocessing are explained below with an
example!
Example Statements:
Dosa is food.
6th statement can be written as: ∀x Eats(x, Bill) -> Eats(x, Sue)
Separation of Facts
Food(Apple)
Food(Dosa)
To Prove
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”.
2. “If Aarohi study then she achieve 1st rank in the exam” <- Fact
“M” implies “N”
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.
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.
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?
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
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
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.
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.
In probabilistic reasoning, there are two ways to solve problems with uncertain
knowledge:
o Bayes' rule
o Bayesian Statistics
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.
Speech Recognition
Bioinformatics
Finance
Bayesian networks are probabilistic, because these networks are built from
a probability distribution, and also use probability theory for prediction and
anomaly detection.
o Causal Component
o Actual numbers
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
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]
THANKU