0% found this document useful (0 votes)
17 views24 pages

Applied Ai U2

This document discusses probability theory and its applications in artificial intelligence. It covers topics like probability, joint probability, conditional probability, Bayes' theorem, cumulative probability, fuzzy sets, fuzzy logic, and their characteristics and applications.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views24 pages

Applied Ai U2

This document discusses probability theory and its applications in artificial intelligence. It covers topics like probability, joint probability, conditional probability, Bayes' theorem, cumulative probability, fuzzy sets, fuzzy logic, and their characteristics and applications.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

MSc(I.

T) PART-2 SEM-III Subject : Applied AI UNIT-II

1-Probability Theory:
Probability

 Probability implies 'likelihood' or 'chance'. When an event is certain to happen then the
probability of occurrence of that event is 1 and when it is certain that the event cannot
happen then the probability of that event is 0.

 Hence the value of probability ranges from 0 to 1.

Formula
P(A)=(Number of favourable cases / Total number of equally likely cases)=m/n

Thus to calculate the probability we need information on number of favorable cases and total
number of equally likely cases. This can he explained using following example.

Example
Problem Statement:

A coin is tossed. What is the probability of getting a head?

Solution:

Total number of equally likely outcomes (n) = 2 (i.e. head or tail)

Number of outcomes favorable to head (m) = 1

P(head)=1/2 = 0.5

What Is a Joint Probability?

 Joint probability is a statistical measure that calculates the likelihood of two events
occurring together and at the same point in time.
 Joint probability is the probability of event Y occurring at the same time that event X
occurs.

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II

Conditional Probability
 The conditional probability of an event B is the probability that the event will occur
given the knowledge that an event A has already occurred.
 This probability is written P(B|A), notation for the probability of B given A.
 In the case where events A and B are independent (where event A has no effect on the
probability of event B), the conditional probability of event B given event A is simply the
probability of event B, that is P(B).

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II
If events A and B are not independent, then the probability of the intersection of A and
B (the probability that both events occur) is defined by

P(A and B) = P(A)P(B|A).

From this definition, the conditional probability P(B|A) is easily obtained by dividing by P(A):

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II
This is because we are removing marbles from the bag.

So the next event depends on what happened in the previous event, and is called dependent.

Bayes’s theorem

 In statistics and probability theory, the Bayes’ theorem (also known as the Bayes’ rule) is
a mathematical formula used to determine the conditional probability of events.
 Essentially, the Bayes’ theorem describes the probability of an event based on prior
knowledge of the conditions that might be relevant to the event.

Example:
Imagine 100 people at a party, and you tally how many wear pink or not, and if a man or not, and
get these numbers:

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II

Bayes' Theorem is based off just those 4 numbers!

But all your data is ripped up! Only 3 values survive:

 P(Man) = 0.4,
 P(Pink) = 0.25 and
 P(Pink|Man) = 0.125

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II

Cumulative Probability

 A cumulative probability refers to the probability that the value of a random variable falls
within a specified range.
 Frequently, cumulative probabilities refer to the probability that a random variable is less
than or equal to a specified value.
 Consider a coin flip experiment. If we flip a coin two times, we might ask: What is the
probability that the coin flips would result in one or fewer heads? The answer would be a
cumulative probability.
 It would be the probability that the coin flip results in zero heads plus the probability that
the coin flip results in one head. Thus, the cumulative probability would equal:

P(X < 1) = P(X = 0) + P(X = 1) = 0.25 + 0.50 = 0.75

The table below shows both the probabilities and the cumulative probabilities associated with
this experiment.

Number of heads Probability Cumulative Probability

0 0.25 0.25

1 0.50 0.75

2 0.25 1.00

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II

Fuzzy Sets and Fuzzy Logic


Fuzzy Logic

 Fuzzy logic is an approach to computing based on "degrees of truth" rather


than the usual "true or false" (1 or 0) Boolean logic on which the modern
computer is based.

 The idea of fuzzy logic was first advanced by Dr. Lotfi Zadeh of the
University of California at Berkeley in the 1960s.

 In fuzzy mathematics, fuzzy logic is a form of many-valued logic in which


the truth values of variables may be any real number between 0 and 1 both
inclusive.

 Fuzzy logic has been used in numerous applications such as facial pattern
recognition, air conditioners, washing machines, vacuum cleaners, antiskid
braking systems, transmission systems, control of subway systems and
unmanned helicopters, knowledge-based systems for multi objective
optimization of power systems

Example of Fuzzy Logic as comparing to Boolean Logic

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II

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

Characteristics of Fuzzy Logic

Following are the characteristics of fuzzy logic:

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.

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II
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.

Architecture of a Fuzzy Logic System

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

Following diagram shows the architecture or process of a Fuzzy Logic system:

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II
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:

o Large Positive (LP)


o Medium Positive (MP)
o Small (S)
o Medium Negative (MN)
o Large negative (LN)

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.

Classical and Fuzzy Set Theory


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:

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II
A set of all-natural numbers
A set of students in a class.
A set of all cities in a state.
A set of upper-case letters of the alphabet.

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.

Mathematical Representation of Sets

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:

Set_name = { element1, element2, element3, ......, element N}

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:

Set of Natural Numbers: N={1, 2, 3, 4, 5, 6, 7, ......,n).

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

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.
 In the fuzzy set, the partial membership also exists. This theory released as an extension
of classical set theory.

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II
 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.

Operations on Fuzzy Set

Given à and B are the two fuzzy sets, and X be the universe of discourse with the following
respective member functions:

The operations of Fuzzy set are as follows:

1. Union Operation: The union operation of a fuzzy set is defined by:

μA∪B(x) = max (μA(x), μB(x))

Example:

suppose A is a set which contains following elements:

A = {( X1, 0.6 ), (X2, 0.2), (X3, 1), (X4, 0.4)}

And, B is a set which contains following elements:

B = {( X1, 0.1), (X2, 0.8), (X3, 0), (X4, 0.9)}

then,

AUB = {( X1, 0.6), (X2, 0.8), (X3, 1), (X4, 0.9)}

Because, according to this operation

For X1

μA∪B(X1) = max (μA(X1), μB(X1))


μA∪B(X1) = max (0.6, 0.1)
μA∪B(X1) = 0.6

For X2

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II

μA∪B(X2) = max (μA(X2), μB(X2))


μA∪B(X2) = max (0.2, 0.8)
μA∪B(X2) = 0.8

For X3

μA∪B(X3) = max (μA(X3), μB(X3))


μA∪B(X3) = max (1, 0)
μA∪B(X3) = 1

For X4

μA∪B(X4) = max (μA(X4), μB(X4))


μA∪B(X4) = max (0.4, 0.9)
μA∪B(X4) = 0.9

2. Intersection Operation:

The intersection operation of fuzzy set is defined by:

μA∩B(x) = min (μA(x), μB(x))

Example:

suppose A is a set which contains following elements:

A = {( X1, 0.3 ), (X2, 0.7), (X3, 0.5), (X4, 0.1)}

And, B is a set which contains following elements:

B = {( X1, 0.8), (X2, 0.2), (X3, 0.4), (X4, 0.9)}

then,

A∩B = {( X1, 0.3), (X2, 0.2), (X3, 0.4), (X4, 0.1)}

Because, according to this operation

For X1

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II

μA∩B(X1) = min (μA(X1), μB(X1))


μA∩B(X1) = min (0.3, 0.8)
μA∩B(X1) = 0.3

For X2

μA∩B(X2) = min (μA(X2), μB(X2))


μA∩B(X2) = min (0.7, 0.2)
μA∩B(X2) = 0.2

For X3

μA∩B(X3) = min (μA(X3), μB(X3))


μA∩B(X3) = min (0.5, 0.4)
μA∩B(X3) = 0.4

For X4

μA∩B(X4) = min (μA(X4), μB(X4))


μA∩B(X4) = min (0.1, 0.9)
μA∩B(X4) = 0.1

3. Complement Operation:

The complement operation of fuzzy set is defined by:

μĀ(x) = 1-μA(x),

Example:

suppose A is a set which contains following elements:

A = {( X1, 0.3 ), (X2, 0.8), (X3, 0.5), (X4, 0.1)}

then,

Ā= {( X1, 0.7 ), (X2, 0.2), (X3, 0.5), (X4, 0.9)}

Because, according to this operation

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II
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
`

Classical Set Theory Fuzzy Set Theory


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 4. It is mainly used for fuzzy controllers.
of digital systems.

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II
Applications of Fuzzy Logic

Following are the different application areas where the Fuzzy Logic concept is widely used:

1. It is used in Businesses for decision-making support system.


2. It is used in Automative systems for controlling the traffic and speed.
3. Fuzzy logic systems also used in Securities.
4. It is also used in microwave oven for setting the lunes power and cooking strategy.
5. This technique is also used in the area of modern control systems such as expert
systems.
6. Finance is also another application where this concept is used for predicting the stock
market, and for managing the funds.
7. It is also used for controlling the brakes.
8. It is also used in the industries of chemicals for controlling the ph, and chemical
distillation process.
9. It is also used in the industries of manufacturing for the optimization of milk and
cheese production.

Advantages of Fuzzy Logic

Fuzzy Logic has various advantages or benefits. Some of them are as follows:

1. The methodology of this concept works similarly as the human reasoning.


2. Any user can easily understand the structure of Fuzzy Logic.
3. It does not need a large memory, because the algorithms can be easily described with
fewer data.
4. It is widely used in all fields of life and easily provides effective solutions to the
problems which have high complexity.
5. This concept is based on the set theory of mathematics, so that's why it is simple.
6. It allows users for controlling the control machines and consumer products.
7. The development time of fuzzy logic is short as compared to conventional methods.
8. Due to its flexibility, any user can easily add and delete rules in the FLS system.

Disadvantages of Fuzzy Logic

Fuzzy Logic has various disadvantages or limitations. Some of them are as follows:

1. The run time of fuzzy logic systems is slow and takes a long time to produce outputs.
2. Users can understand it easily if they are simple.

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II
3. The possibilities produced by the fuzzy logic system are not always accurate.
4. Many researchers give various ways for solving a given statement using this technique
which leads to ambiguity.
5. Fuzzy logics are not suitable for those problems that require high accuracy.
6. The systems of a Fuzzy logic need a lot of testing for verification and validation.

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 is also known as indicator or characteristics function.
 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.

Membership function (MF) - A function that specifies the degree to which a given input belongs to a set.

Degree of membership- The output of a membership function, this value is always limited to between 0
and 1. Also known as a membership value or membership grade.

Membership functions are used in the fuzzification and defuzzification steps of a FLS (fuzzy logic
system), to map the non-fuzzy input values to fuzzy linguistic terms and vice versa.

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II
Types of Membership Functions:

There are different forms of membership functions such as:


o Triangular.
o Trapezoidal.
o Piecewise linear.
o Gaussian.
o Singleton.

Fuzzy singleton- A fuzzy set with a membership function that is unity at a one particular point and zero
everywhere else.

Triangular MFs
A triangular MF is specified by three parameters {a, b, c} as follows:

By using min and max, we have an alternative expression for the preceding equation:

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II

Fuzzy Membership Function: Basic Concepts

Support: elements having non-zero degree of membership.


Core: set with elements having degree of 1.
𝜶-Cut: set of elements with degree >= α.
Height: maximum degree of membership.

Membership Functions in the Fuzzy Logic Toolbox

A membership function (MF) is a curve that defines how each point in the input space is
mapped to a membership value (or degree of membership) between 0 and 1. The input space is
sometimes referred to as the universe of discourse.
The only condition a membership function must really satisfy is that it must
vary between 0 and 1.

Features of Membership Functions

We will now discuss the different features of Membership Functions.

Core
For any fuzzy set A˜, the core of a membership function is that region of universe that is
characterize by full membership in the set. Hence, core consists of all those elements y of the
universe of information such that,

μA˜(y)=1

Support
For any fuzzy set A˜, the support of a membership function is the region of universe that is
characterize by a nonzero membership in the set. Hence core consists of all those elements y of
the universe of information such that,

μA˜(y)>0

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II

Boundary

For any fuzzy set A˜, the boundary of a membership function is the region of universe that is
characterized by a nonzero but incomplete membership in the set. Hence, core consists of all
those elements y of the universe of information such that,

1>μA˜(y)>0

Problem No.1
The elements in two sets A and Bare given as A={2,4} and B= {a,b,c) Find the various
Cartesian products of these two sets.
Find AXB=? BXA=? AXA=? BXB=?
Solution:.'I'he various Cartesian products of these two given sets are

A X B = {(2, a). (2. b), (2, c), (4, a), (4, b), (4, c)}
B x A = {(a, 2), (a, 4), (b, 2), (b, 4), (c, 2), (c, 4))
Ax A = A2 = { ((2,2), (2,4). (4,2), (4.4)}
BXB = B2 = {(a,a),(a,b),(a,c),(b,b),(b,a),(b,c),(c,c),(c,a),(c,b)};

Problam No.2(Solve in Reference Boo(TB04_soft-computing-ebook)


Problam No.3(Solve in Reference Boo(TB04_soft-computing-ebook)

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II
Note

 A fuzzy set A is characterised by a generalised characteristic function A : X !


 [0; 1], called membership function of A and de¯ned over a universe of discourse X.

 This universe of discourse in a concrete case has to be chosen according to the speci¯c
situation of this case.

 Obviously, for each usual, i.e. crisp set M its usual characteristic function

 such a membership function. Therefore we consider crisp sets as special cases of fuzzy
sets, viz. those ones with only 0 and 1 as membership degrees. Fuzzy sets A;B are equal
if they have the same membership functions:

 We use IF(X) to denote the class of all fuzzy subsets of the universe of discourse X.
 If one intends to describe some fixed fuzzy set A over the universe of discourse X then
one defines its membership function either by giving some formula to describe
, or by a table of the values, or by a picture of the graph of .
 Using a table for this purpose is especially useful for finite universes of discourse X. E.g.
for X0 = {a1; a2; : : : ; a6} the table
 C : a1 a2 a3 a4 a5 a6
0:3 0:7 0:9 0:6 0 0:2
 describes a fuzzy set C with C(a2) = 0:7 and C(a6) = 0:2. In the case that one has a
natural ordering for the elements of the universe X.

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II

Operations with Fuzzy Sets

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054


MSc(I.T) PART-2 SEM-III Subject : Applied AI UNIT-II

Compiled by Prof. Ansari Mohd. Shahid([email protected]) Mob. 7977-079-345 / 9821-77-1054

You might also like