AI - Module 4
AI - Module 4
AI - Module 4
Artificial intelligence
Module - 4
Uncertainty:
Example:
In a class, there are 70% of the students who like
English and 40% of the students who likes English and
mathematics, and then what is the percent of students
those who like English also like mathematics?
Solution:
Let, A is an event that a student likes Mathematics
B is an event that a student likes English.
Hence, 57% are the students who like English also like
Mathematics.
Bayes' theorem in Artificial intelligence
Bayes' theorem:
Bayes' theorem is also known as Bayes' rule, Bayes' law,
or Bayesian reasoning, which determines the probability
of an event with uncertain knowledge.
In probability theory, it relates the conditional probability
and marginal probabilities of two random events.
Bayes' theorem was named after the British mathematician
Thomas Bayes. The Bayesian inference is an application
of Bayes' theorem, which is fundamental to Bayesian
statistics.
Bayes' theorem in Artificial intelligence
It is a way to calculate the value of P(B|A) with the knowledge of P(A|B).
Bayes' theorem allows updating the probability prediction of an event by
observing new information of the real world.
With Bayes’;
P(positive|covid19) = 0.99
P(covid19) = 0.6
P(positive) = 0.6*0.99+0.4*0.01=0.598
Example of Bayes Theorem (Cont..)
Application of Bayes' theorem in Artificial intelligence:
0 Rainy Yes
1 Sunny Yes
2 Overcast Yes
3 Overcast Yes
4 Sunny No
5 Rainy Yes
6 Sunny Yes
7 Overcast Yes
8 Rainy No
9 Sunny No
10 Sunny Yes
11 Rainy No
12 Overcast Yes
13 Overcast Yes
Frequency Distribution
Weather Yes No
Overcast 5 0
Rainy 2 2
Sunny 3 2
Total 10 4
Likelihood Table of Work Condition
Weather No Yes
Rainy 2 2 4/14=0.29
Sunny 2 3 5/14=0.35
P(No|Sunny)= P(Sunny|No)*P(No)/P(Sunny)
P(Sunny|NO)= 2/4=0.5
P(No)= 0.29
P(Sunny)= 0.35
So P(No|Sunny)= 0.5*0.29/0.35 = 0.41
So as we can see from the above calculation that P(Yes|Sunny)>P(No|
Sunny)
Hence on a Sunny day, Player can play the game.
Advantages of Naïve Bayes Classifier:
• 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 In the above diagram, A, B, C, and D
are random variables represented by the nodes of the network
graph.
• 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.
• Node C is independent of node A.
components of Bayesian network :
Note: The Bayesian network graph does not contain any
cyclic graph. Hence, it is known as a directed acyclic graph
or DAG.
The Bayesian network has mainly two components:
• Causal Component
• 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.
Bayesian network is based on Joint probability distribution
and conditional probability. So let's first understand the joint
probability distribution:
Joint probability distribution:
In general for each variable Xi, we can write the equation as:
P(Xi|Xi-1,........., X1) = P(Xi |Parents(Xi ))
Explanation of Bayesian network:
• 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.
• 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.
• The conditional distributions for each node are given as conditional
probabilities table or CPT.
• 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.
• 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
Solution (Cont..)
Let's take the observed probability for the Burglary and earthquake
component:
P(B=True) = 0.002, which is the probability of burglary.
P(B=False) = 0.998, which is the probability of no burglary.
P(E=True) = 0.001, which is the probability of a minor earthquake
P(E=False)= 0.999, Which is the probability that an earthquake not
occurred.