Soft Computing Test

Download as pdf or txt
Download as pdf or txt
You are on page 1of 95

Module 1

(Basic tools of soft computing)

Content
- Basic characteristics of AI and soft
computing
- Evolutionary computing
- Approximation of Multivariate functions
- Non-linear error surface and optimization
Lecture - 1
INTRODUCTION
What is intelligence?
Real intelligence is what determines the normal thought process
of a human.
Artificial intelligence is a property of machines which gives it
ability to mimic the human thought process. The intelligent
machines are developed based on the intelligence of a subject, of
a designer, of a person, of a human being.
How do we achieve it?
Before we model a system, we need to observe.
What is AI?
Artificial Intelligence is concerned with the design of intelligence in
an artificial device.
Practical applications of AI –
AI components are embedded in numerous devices like -in copy
machines for automatic correction of operation for copy quality
improvement.
AI systems are in everyday use -
1. For identifying credit card fraud
2. For advising doctors
3. For recognizing speech and in helping complex planning tasks.
4. Intelligent tutoring systems that provide students with
personalized attention.
Intelligent behavior –
This discussion brings us back to the question of what constitutes
intelligent behavior.
Some of these tasks and applications are:
1. Perception involving image recognition and computer vision
2. Reasoning
3. Learning
4. Understanding language involving natural language
processing, speech processing
5. Solving problems
6. Robotics

What is soft computing?


Soft computing is an approach to computing which parallels the
remarkable ability of the human mind to reason and learn in an
environment of uncertainty and imprecision.

It is characterized by the use of inexact solutions to


computationally hard tasks such as the solution of nonparametric
complex problems for which an exact solution can’t be derived in
polynomial of time.
Why soft computing approach?
Mathematical model & analysis can be done for relatively simple
systems. More complex systems arising in biology, medicine and
management systems remain intractable to conventional
mathematical and analytical methods. Soft computing deals with
imprecision, uncertainty, partial truth and approximation to
achieve tractability, robustness and low solution cost. It extends
its application to various disciplines of Eng. and science. Typically
human can:
1. Take decisions
2. Inference from previous situations experienced
3. Expertise in an area
4. Adapt to changing environment
5. Learn to do better

Social behavior of collective intelligence intelligent control


strategies have emerged from the above mentioned
characteristics of human/ animals. The first two characteristics
have given rise to Fuzzy logic; 2nd, 3rd and 4th have led to
Neural Networks; 4th, 5th and 6th have been used in evolutionary
algorithms.
Lecture – 2
Characteristics of Neuro-fuzzy and soft computing
1. Human Expertise
2. Biologically inspired computing models
3. New Optimization Techniques
4. Numerical Computation
5. New Application domains
6. Model-free learning
7. Intensive computation
8. Fault tolerance
9. Goal driven characteristics
10. Real world applications

Types of Soft Computing


1. Fuzzy Logic
2. Neural networks
3. Evolutionary Algorithms
Lecture- 3
Fuzzy Logic

When we say fuzzy logic, that is the variables that we encounter


in physical devices, fuzzy numbers are used to describe these
variables and using this methodology when a controller is
designed, it is a fuzzy logic controller.

- Let us take three statements: zero, almost zero, near zero.


- Zero is exactly zero with truth value assigned 1
- If it is almost 0, then I can think that between minus 1 to 1, the
Values around 0 is 0, because this is almost 0.
- When I say near 0, maybe the bandwidth of the membership
which represents actually the truth value.
You can see that it is more, bandwidth increases near 0.

-This is the concept of fuzzy number.

-Without talking about membership now, but a notion is that I


allow some small bandwidth when I say almost 0.
-When I say near 0 my bandwidth still further increases.
-In the case minus 2 to 2, when I encounter any data between
minus 2 to 2, still I will consider them to be near 0.
-As I go away from 0 towards minus 2, the confidence level how
near they are to 0 reduces; like if it is very near to 0, I am very
certain.
-As I progressively go away from 0, the level of confidence also
goes down, but still there is a tolerance limit. So when zero I am
precise, I become imprecise when almost and I further become
more imprecise in the third case.
When we say fuzzy logic, that is the variables that we encounter
in physical devices, fuzzy numbers are used to describe these
variables and using this methodology when a controller is
designed, it is a fuzzy logic controller.
Lecture-4
Neural Networks
- Neural networks are basically inspired by various way of
observing the biological organism.
- Most of the time, it is motivated from human way of learning. It is
a learning theory. This is an artificial network that learns from
example and because it is distributed in nature, fault tolerant,
parallel processing of data and distributed structure.
- The basic elements of artificial Neural Network are:
1.Input nodes
2. Weights
3. Activation function and
4. Output node.
- Inputs are associated with synaptic weights. They are all
Summed and passed through an activation function giving output
y. In a way, output is summation of the signal multiplied with
synaptic weight over many input channels.

Fig. Basic elements of an artificial neuron


Fig. Analogy of
Biological
neuron and
artificial neuron

- Above fig. Shows a biological neuron on top.


- Through axon this neuron actuates the signal and this signal is
sent out through synapses to various neurons.
- Similarly shown a classical artificial neuron(bottom).
- This is a computational unit.
- There are many inputs reaching this.
- The input excites this neuron.
- Similarly, there are many inputs that excite this computational
unit and the output again excites many other units like here.
- Like that taking certain concepts in actual neural network, we
develop these artificial computing models having similar structure.
-There are various locations where various functions take place in
the brain.
If we look at a computer and a brain, this is the central processing
unit and a brain.
Let us compare the connection between our high speed
computers that are available in the market today and a brain.

- Approximately there are 10 to the power of 14 synapses in the


human brain, whereas typically you will have 10 to the power of 8
transistors inside a CPU.
- The element size is almost comparable, both are 10 to the
power minus 6 and energy use is almost like 30 Watts and
comparable actually; that is energy dissipated in a brain is almost
same as in a computer. But you see the processing speed.
- Processing speed is only 100 hertz; our brain is very slow,
whereas computers nowadays, are some Giga hertz.
- When you compare this, you get an idea that although computer
is very fast, it is very slow to do intelligent tasks like pattern
recognition, language understanding, etc.
- These are certain activities which humans do much better, but
with such a slow speed, 100 Hz contrast between these two, one
of the very big difference between these two is the structure; one
is brain, another is central processing unit is that the brain learns,
we learn.
- Certain mapping that is found in biological brain that we have
studied in neuroscience is not there in a central processing unit
and we do not know whether self awareness takes place in the
brain or somewhere else, but we know that in a computer there is
no self-awareness.
Neural networks are analogous to adaptive control concepts that
we have in control theory and one of the most important aspects
of intelligent control is to learn the control parameters, to learn the
system model.
- Some of the learning methodologies we will be learning here is
the error-back propagation algorithm, real-time learning algorithm
for recurrent network, Kohonen‟s self organizing feature map &
Hopfield network.
Lecture- 5
Features of Artificial Neural Network(ANN) models
1. Parallel Distributed information processing
2. High degree of connectivity between basic units
3. Connections are modifiable based on experience
4. Learning is a continuous unsupervised process
5. Learns based on local information
6. Performance degrades with less units

So, in this paper we will be discussing various tools.


- These tools are actually developed by mimicking the
human behavior, but not the human way of working.
- An intelligent machine is one which learns, thinks and
behaves in line with the thought process. (That we
would like but we are very far from it. At least, at the
moment, we are very far from this target of achieving
real intelligence.)

- We perceive the environment in a very unique way, in


a coherent manner.
- This is called unity of perception and intelligence has
also something to do with this unity of perception,
awareness and certain things are not very clear to us
until now.
- So an intelligent machine is one which learns, thinks &
behaves in line with thought process.
Lecture-6
Characteristics of soft computing
1. Human Expertise
2. Inspired computing models
3. New operation techniques
4. Model-free learning
5. Intensive Computation
6. Fault tolerance
Types of Soft Computing
1. Fuzzy Logic
2. Neural Networks
3. Evolutionary algorithms
Fuzzy logic
- It is a mathematical language to express something.
- It is a language; it has grammar, syntax for communication.
- It is another form of logic whose range lies between 0 to1
- It means number of elements present will give the probable
values to the computing procedure.
Logic is of two types
1. Fuzzy logic
2. Crisp logic
Crisp logic
Crisp logic depends upon the direct true or false value. It
means exactly completely true or exactly completely false.
True ->1
False->0

According to crisp logic:

Is Ram Honest ? {0,1}


True/Yes/1
False/No/0

According to fuzzy logic:

Is Ram Honest ?
True/Yes/1
Very Honest/0.85
Sometimes Honest/0.35
False/No/0

Fuzzy Set
Membership function(UA)
UA= Membership values for the set A
U Ā= x[0,1]

Crisp Set
U A : x[0,1]
Fuzzy set is defined as
{(x, U Ā(x) ) | x ∈ X}
Lecture-7

Q. Create a fuzzy set with its membership values to


represent in the form of fuzzy equation.
X={1,2,3,4,5,6,---} for ∀ x ∈ X
Ā= {“two or so”}

Ans-
U Ā (1) = 0.5
U Ā (2) = 1
U Ā (3) = 0.5
U Ā (4) = 0
U Ā (5) = 0
U Ā (6) = 0

So, the required fuzzy set for the above problem is


Ā={(1,0.5),(2,1),(3,0.5),(4,0),(5,0),(6,0)}
Fuzzy set equation is:
(U Ā /(x1))/x1 +(U Ā /(x2))/x2 +(U Ā /(x3))/x3 +…..
Where x1, x2,x3 ….. ∈ X

=>(0.5/1)+(1/2)+(0.5/3)+(0/4)+(0/5)+(0/6)+….

Q. X={10,20,30,40,50,60,70,80} set of group


Ā= {“John is young”}
Ans-
U Ā (10) = 1
U Ā (20) = 0.9
U Ā (30) = 0.8
U Ā (40) = 0.5
U Ā (50) = 0.2
U Ā (60) = 0
U Ā (70) = 0
U Ā (80) = 0

So, the required fuzzy set for the above problem is


Ā={(10,1),(20,0.9),(30,0.8),(40,0.5),(50,0.2),(60,0),(70,0),(80,
0)}
Fuzzy set equation is:
(U Ā /(x1))/x1 +(U Ā /(x2))/x2 +(U Ā /(x3))/x3 +…..
Where x1, x2,x3 ….. ∈ X

=>(1/10)+(0.9/20)+(0.8/30)+(0.5/40)+(0.2/50)+(0/60)+(0/70)+
(0/80)
Lecture-8

If the equation comes with same data but another

Ā2= {“John is young”}


(Ā2∈ Ā1) Ā2 is a subset of Ā1

QX={5,15,25,35,45,55,65,75,85}

Fuzzy set
1. Infant
2. Young
3. Adult
4. Senior

Age Infant Young Adult Senior


5 0 0 0 0
15 0 0.2 0 0
25 0 0.8 0.8 0
35 0 1 0.9 0
45 0 0.6 1 0
55 0 0.5 1 0.3
65 0 0.1 1 0.9
75 0 0 1 1
85 0 0 1 1
For young
U Ā (5) = 0
U Ā (15) = 0.2
U Ā (25) = 0.8
U Ā (35) = 1
U Ā (45) = 0.6
U Ā (55) = 0.5
U Ā (65) = 0.1
U Ā (75) = 0
U Ā (85) = 0

So, the required fuzzy set for very young is


Ā={(5,0),(15,0.2),(25,0.8),(35,1),(45,0.6),(55,0.5),(65,0.1),(75
,0),(85,0)}

Fuzzy set equation is:


(U Ā /(x1))/x1 +(U Ā /(x2))/x2 +(U Ā /(x3))/x3 +…..
Where x1, x2,x3 ….. ∈ X

=>(0/5)+(0.2/15)+(0.8/25)+(1/35)+(0.6/45)+(0.5/55)+(0.1/65)
+(0/75)+(0/85)

For adult
U Ā (5) = 0
U Ā (15) = 0
U Ā (25) = 0.8
U Ā (35) = 0.9
U Ā (45) = 1
U Ā (55) = 1
U Ā (65) = 1
U Ā (75) = 1
U Ā (85) = 1

So, the required fuzzy set is


Ā={(5,0),(15,0),(25,0.8),(35,0.9),(45,1),(55,1),(65,1),(75,1),(8
5,1)}

Fuzzy set equation is:


(U Ā /(x1))/x1 +(U Ā /(x2))/x2 +(U Ā /(x3))/x3 +…..
Where x1, x2,x3 ….. ∈ X

=>(0/5)+(0/15)+(0.8/25)+(0.9/35)+(1/45)+(1/55)+(1/65)+(1/75
)+(1/85)

For senior the fuzzy set is


Ā={(5,0),(15,0),(25,0),(35,0),(45,0),(55,0.3),(65,0.9),(75,1),(8
5,1)}

Fuzzy set equation is:


(U Ā /(x1))/x1 +(U Ā /(x2))/x2 +(U Ā /(x3))/x3 +…..
Where x1, x2,x3 ….. ∈ X

=>(0/5)+(0/15)+(0/25)+(0/35)+(0/45)+(0.3/55)+(0.9/65)+(1/75
)+(1/85)
Module-2
Lecture-1
Implement the basic fuzzy set operations

Ā={(1.0,1),(1.5,0.75),(2.0,0.3),(2.5,0.15),(3.0,0)} ∀ x ∈ X
B̅={(1.0,1),(1.5,0.6),(2.0,0.2),(2.5,0.1),(3.0,0)} ∀ y ∈ Y

C̅= Ā U B̅=max(μ Ā(x1), μ B̅(y1) )/x1+y1

C̅= Ā ∩ B̅=min(μ Ā(x1), μ B̅(y1) )/x1+y1

Ā={(0.5/x1)+(0.2/x2)+(0.9/x3)}

X=x1,x2,x3=3

B̅={(1/y1)+(0.5/y2)+(1/y3)}

Y=y1+y2+y3=3

Ā= {(x1,0.5),(x2,0.2),(x3,0.9)}
B̅= {(y1,1),(y2,0.5),(y3,1)}
The Cartesian of Ā and B̅ are

y1 y2 y3

R= x1 0.5 0.5 0.5

x2 0.2 0.2 0.2

x3 0.9 0.5 0.9

 μ R (x1,y1)= Min[μ Ā(x1), μ B̅(y1) ]


=min(0.5,1)

Fuzzy equation

R=(0.5/x1y1)+(0.5/x1y2)+(0.5/x1y3)+(0.2/x2y1)+(0.2/x2y2)+(0.2/x2y3)+
(0.9/x3y1)+(0.5/x3y2)+(0.9/x3y3)
Lecture-2
Fuzzy Composition

A fuzzy relation Ṝ is mapping function from the Cartesian space “X * Y”


to the interval between [0, 1] where the membership function of the
relation Ṝ will be expressed as:

μ Ṝ (x,y)

μ R : Ā * B̅ [0,1]

R={(x,y), μR(x,y)| μR(x,y)≥0 }

Where ∀ : x ∈ Ā , y ∈ B̅

Let Ṝ is a fuzzy relation on the Cartesian space(X*Y)

Let S is a fuzzy relation in between (Y * Z)

T= X*Z  μT (x,z)

T= Ṝ o S

Different ways to solve the composition

 1. Max-mini composition

 2. max-product composition

Composition Rule

T(x,z)=max(min(R(x,y),s(y,z)))

y∈Y
Extra problem-

X={x1,x2},Y={y1,y2},Z={z1,z2,z3}

𝑦1 𝑦2 𝑧1 𝑧2 𝑧3
R= 𝑥1 𝑜. 6 0.3 S= 𝑦1 0.1 0.5 0.3
𝑥2 0.2 0.9 𝑦2 0.8 0.4 0.7

Find T?

Ans-

μT (x1,z1)=max{min[μR(x1,y1), μs(y1,z1)],min[μR(x1,y2), μs(y2,z1)]}

=max{min(0.6,1),min(0.3,0.8)}

=max(0.6,0.3)

=0.6

μT (x2,z2)=max{min[μR(x2,y1), μs(y1,z2)],min[μR(x2,y2), μs(y2,z2)]}

=max{min(0.2,0.5),min(0.9,0.4)}

=max(0.2,0.4)

=0.4

μT (x1,z2)= max{min(0.6,0.5),min(0.3,0.4)}

=max(0.5,0.3)

=0.5

μT (x1,z3)= max{min(0.6,0.3),min(0.3,0.7)}

=max(0.3,0.3)
=0.3

μT (x2,z1)= max{min(0.2,1),min(0.9,0.8)}

=max(0.2,0.8)

=0.8

μT (x2,z3)= max{min(0.2,0.3),min(0.9,0.7)}

=max(0.2,0.7)

=0.7
𝑧1 𝑧2 𝑧3
T= 𝑥1 0.6 0.5 0.3
𝑥2 0.8 0.2 0.2
Lecture-2

Max-product composition

T(x,z)=max{μR(x,y). μs(y,z)}

Same above of Q-1

μT (x1,z1)=max{[μR(x1,y1). μs(y1,z1)],[μR(x1,y2). μs(y2,z1)]}

=max{(0.6,0.1).(0.3,0.8)}

=max(0.6,0.24)

=0.6

μT(x1,z1)=0.6
Lecture-3

Types of membership function graph

Fig. Membership functions a. Triangle b. Trapezoidal c. Gaussian d.


Bell, e. Left f. Right
Fuzzy Formulation with parameters

- Triangular MFC is specified by 3 parameters {a,b,c}. So, it can be


formulated as follows

𝟎 𝒊𝒇 𝒙 ≤ 𝟎
𝒙−𝒂
𝒊𝒇 𝒂 ≤ 𝒙 ≤ 𝒃
𝒃−𝒂
Triangular (x:a,b,c)= 𝒄−𝒙
𝒊𝒇 𝒃 ≤ 𝒙 ≤ 𝒄
𝒄−𝒃
{ 𝟎 𝒊𝒇 𝒄 ≤ 𝒙
- Trapezoidal MFC is specified by 4 parameters {a,b,c,d} diagram

𝟎 𝒊𝒇 𝒙 ≤ 𝒂
𝒙−𝒂
𝒊𝒇 𝒂 ≤ 𝒙 ≤ 𝒃
𝒃−𝒂
Trapezoidal (x:a,b,c,d) = 𝟏 𝒊𝒇 𝒃 ≤ 𝒙 ≤ 𝒄
𝒄−𝒙
𝒊𝒇 𝒄 ≤ 𝒙 ≤ 𝒅
𝒄−𝒃
{ 𝟎 𝒊𝒇 𝒅 ≤ 𝒙
- ∏ shape MFC -∏ shape MFC(x:c,σ)
=𝒆−𝟏/𝟐 ((x-c)/ σ)
- Gaussian MFC- Gaussian(x:a,b,c)=(1)/(1+(|((𝐱 − 𝐜)/𝐚)|)𝟐𝒃 )
Lecture-4

Defuzzification-

The conversion of fuzzy set to a single crispy value is called as


defuzzification.

The reverse conversion of crispy set to the fuzzy set is called


fuzzification.

Different methods of defuzzification

1. Max-membership principle

μ C (x*) ≥ μ C (x) ∀ : x ∈ X
2. Centroid method
If Ā1st membership function
B̅2nd membership function
then C̅Defuzzification input of A and B
Then
x*= (∫μC̅ (x) .x dx )/( ∫μC̅ (x) .dx)

3. Weighted Average method


x*=(∑ μC (xi).xi)/(∑ μC (xi))
This method is vaid for symmetrical output.
4. Mean-max membership
This method is also called as middle of maxima which is closely
related to max membership function.
𝑛
(𝑥 )∗ = (∑𝑖=1 xi) /n
𝑤ℎ𝑒𝑟𝑒 𝑛 = 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑒𝑙𝑒𝑚𝑒𝑛𝑡𝑠

5. Centre of sums

This method is the algebraic sum of the individual subsets instead


of their union operations.
𝑛 𝑛

(𝑥 )∗ = (∫ 𝑥 ∑ μCi(x) 𝑥. 𝑑𝑥) / (∫ 𝑥 ∑ μCi(x) 𝑑𝑥)


𝑖=1 𝑖=1

6. Centre of largest area

It is also called as convex fuzzy sets.

This method can be adopted when output consists of 2 convex-fuzzy


subsets and which are not overlapping.

(𝑥 )∗ = (∫ μCi(x)𝑥. 𝑑𝑥)/(∫ μCi(𝑥)𝑑𝑥)


Where Ci=convex sub-region that has the largest area to make the
defuzzical value
Lecture-5

Q. For the given membership function, determine the de-fuzzified


output value by using all the defuzzification principles.
i>max-membership principle

μ C (x*) =1

x*=1 yes

ii>Centroid method

(x1 y1) (x2 y2)

(0 0) (1 0.7)

OA =>y=mx+c

y-y1={(y2-y1)/(x2-x1)} *(x-x1)

=>(y-y1)={(0.7-0)/(1-0)}*(x-x1)

=>(y-y1)=(0.7/1)(x-x1)

=>y=0.7(x)

AB=> y=0.7

BC=> (x1 y1) (x2 y2)

(2.7 0.7) ( 3 1)

y=>{(1-0.7)/(3-2.7)}*(x-x1)

y=x-2

CD=y=1

DE=(x1 y1)(x2 y2)

(5 1)(6 0)

y-y1=>{(0-1)/(6-5)}*(x-x1)
=>-1/1(x-x1)

y=> -x-5+1

=>-x+6

y=x+6

DE=y=x+6

(𝑥 )∗ = (∫ μC(x)𝑥. 𝑑𝑥)/(∫ μC(𝑥)𝑑𝑥)


 Center of sum:-
(∫ 𝒙 ∑𝒏
𝒊=𝟏 𝛍𝐂𝐢(𝐱)𝒙.𝒅𝒙)
 (𝒙 )∗ =
(∫ 𝒙 ∑𝒏
𝒊=𝟏 𝛍𝐂𝐢(𝐱)𝒅𝒙)

 Area of trapezodial-1:

A1=1st half of Δ1
Δ1= (1/2)*1*0.7=0.35

Δ2=(1/2)*1*0.7=0.35

□=>2*0.7=1.4

Total=>0.35+0.35+1.4=>2.1

A1=2.1

 Area of Trapezium-2:

 Δ1=(1/2)*1*1=0.5

 Δ2=0.5

 □=2*1

 Area=3

 A2=3

 =>{(2.1*2)+(3*4)}/A1+A2

 =>{(2.1*2)+(3*4)}/2.1+3

 =>{4.2+12}/5.1

 =>16.2/5.1=3.17

 Centre of Largest Area

 Among this 2 trapezodial , the area of the 2nd is larger than the
1st so for this the de-fuzzified o/p will be implemented upon the
2nd area.
=>{(0.5*2.5)+(2*8)+(0.5*5.5)}/(0.5+4+0.5)

=>4

Weighted –Average Method

X*=(0.7*2)+(1*4)/0.7+1

=1.4+4/1.7

=3.17

Min-max Method

=>(𝒙)∗ = (∑𝒏𝒊=𝟏 𝐱𝐢 /n )=(3+5)/2=4


Lecture-6

FUZZY PROPOSITIONS -

->Fuzzy proposition in a statement that drives a fuzzy truth value.

->Main difference between classical proposition and fuzzy propositions


is in the range of their truth value

→ The proposition value for a classical proposition is either true or false


but, in case of fuzzy composition the range is not confirmed but the
range is 0 and 1.

->The classical proposition is otherwise known as crisp proposition

T(P)= μA(x)

Where P=proposition logic

T=truth value

1. Conjuction
T(P)= μA(x) &T(Q)= μB(x)
Then P ꓥ Q: x is A and B
T(PꓥQ)=min[T(P),T(Q)]
2. Disjunction
P V Q : x is A or B
T(P V Q)=max[T(P),T(Q)]
3. Negation
T(PC)=1-T(P)
4. Implication
P-> C:x is A then x is B
=>T(P->)=T(PC VQ)= max[T(PC);T(Q)]
Fuzzy Inference: - It is the combination of set of rules which will be used
to solve the problems related to the fuzzy logic by combining the
number of fuzzy sets which creates a fuzzy relation “R”

1. IF-THEN statement
2. IF-THEN-ELSE statement

a. IF THEN statement (=> )


If ‘x’ is A then y is B equivalent to
R=(A*B)U(Ā*Y) where Ā->complement
=>μR (x,y)=max(min[μA(x), μB(y)] min([1- μA(x)],U)
Lecture-7
Lecture-8

Fuzzy Interface System

 Data base- Holds the membership function of each elements of


the fuzzy set. It depends upon the rule base.

 Rule base-It holds the number of rules so that it can implement to

 Knowledge base-It holds all the data so that it can lead to the
process of fuzzification and defuzzification.

 Here the fuzzy values will added together to take decisions which
in-return mixes up with the knowledge base and the
defuzzification process goes on.

 Then after defuzzification process a particular output or crisp


value/decision has been generated.

 There are 2 types of FIS-

 1. Mamadani FIS 2.Takage-Sugena FIS


Mamadani FIS

 Mamadani FIS is one of the type of fuzzy Interface system which is


based upon the fuzzification and defuzzification process.

Steps to implement Mamadani FIS

 Step-1-Determine a set of Fuzy rules.

 Step-2-Make the inputs fuzzy using input membership functions.

 Step-3-Combine the fuzzzified inputs according to the fuzzy rules


for establishing a rule strength.

 Step-4-Determine the consequent (resultant ) of the rule by


combining the rule strength and output membership function.

 Step-5-Combine all the consiquents to get all the output


distribution.

 Step-6-Finally a defuzzified output distribution is obtained.

Rule-1- If A1 is x1 and A2 is x2 THEN y is B1,


Takage-Sugena FIS Model
MODULE-3
NEURAL NETWORK

 Neural networks are those information processing system which are constructed and
implemented to model the human brain.

 The main objective of the neural network is to develop a computational device for
modelling the brain to perform various computational task at a faster rate than the
traditional system.

 An artificial neural network is a computational model based on the structure and


functions of biological neural network consists of neurons.

NEURAL NETWORK ARCHITECTURE

 An artificial neural network (ANN) is defined as a data processing system consisting of a


large no. of simple ,highly interconnected processing elements(i.e,known as artificial
neurons)

 ANN can be represented by using a directed graph.

 The graph G consists of a V and E i.e;

V for set of vertices

E for set of Edges

So, our neural network Architecture is divided into 3 types-

1. Single layer Feed Forward Network

2. Multi-layered feed Forward Network

3. Recurrent Network

Single layer Feedforward Network

 As in the input layer the information is being grasped for processing means it only
accepts all the information but in the output layer all the information will be processed
simultaneously the action/the output will also be generated.

 So, as the processing and the output declaration is being handled in the output
declaration is being handled in the output layer so to reduce the burden the multilayer
feedforward network has been discovered.
Single layer Feedforward Network

Multi-layered Feed Forward Network

Recurrent network
IMPORTANT FEATURES OF ANN

 1. Weights

 2. Bias

𝑤11 𝑤12 … … 𝑤1𝑚


𝑤21
. 𝑤22
. … … 𝑤2𝑚
.
W= . . .
. . .
𝑤𝑛1 𝑤𝑛2 … … 𝑤𝑛𝑚
X=(1-…….,x1,…..xi,……..,xn)

Yinj=∑𝑛𝑖=0 𝑥𝑖𝑊𝑖𝑗

=>x0W0j+x1W1j+x2W2j+………+xnWnj

Yinj=bj+∑𝑛𝑖=1 𝑥𝑖𝑊𝑖𝑗

[x1,x2]=[0.2,0.6] [w1,w2]=[0.3,0.7] b1=[0.45]

Calculate the net output Y.

 Ans-Yin=0.45+(0.2*0.3)+(0.6*0.7)

=0.93
ACTIVATION FUNCTION
 To make more efficient and to obtain exact output some force (push) or activation may
Be given.

 This activation helps in achieving the exact output.

 In similar way there are some activation function are there which will be applied over
the net input to calculate the net output of the ANN.

 There are 5 types of activation functions such as –

 1. Identity function

 2.Binary Step Function

 3.Bipolar step function

 4.Sigmoidal Function

 5. Ramp function

1.IDENTITY FUNCTION

It is a linear function and can be defined as

2.BINARY STEP FUNCTION

 f(x)={1 if x ≥ Ѳ

={0 if x < Ѳ

Where Ѳ represents the threshold value

This function is mostly used in single layered feed-forward network.


3.BIPOLAR STEP FUNCTION
 f(x)={1 if x ≥ Ѳ

={-1 if x < Ѳ

 It is also used for single layer feed forward network where Ѳ represents the threshold
value.

4.SIGMOIDAL FUNCTION
1. Binary Sigmoid function

f(x)=1/(1+(𝑒 −⋋𝑥 ))

Where ⋋ =steepness parameter


Range of binary sigmoid function is from 0 to 1.

2. Bipolar sigmoid function

f(x)=(1-(𝑒 −⋋𝑥 ))/(1+(𝑒 −⋋𝑥 ))

5.RAMP FUNCTION
 f(x)={ 1 if x>1

={ x if 0≤x ≤1

={0 if x<0

PROBLEM 1

 [x1,x2,x3]=[0.8,0.6,0.4]

 [W1,W2,W3]=[0.1,0.3,-0.2]

 Where b=0.35

 1. Calculate the net output from the above structure

 2. Activate the output process by using activation method

 (A)Binary Sigmoid
 (B)Bipolar Sigmoidal

(1)Yin=0.35+(0.8*01)+(0.6*0.3)+(0.4*-0.2)

=0.35+0.18= 0.53

(2(A))Binary Sigmoidal

f(x)=1/(1+(𝑒 −⋋𝑥 ))

=>f(x)=1/(1+(𝑒 −0.53 ))=0.629=0.63

(2(B))Bipolar Sigmoidal

f(x)=(1-(𝑒 −⋋𝑥 ))/(1+(𝑒 −⋋𝑥 ))

=(1-(𝑒 −0.53 ))/(1+(𝑒 −0.53 ))

=0.258

PROBLEM 2(vey important)

 [x1,x2,x3,x4]=[0.5,0.9,0.2,0.3]

 [W1,W2,W3,W4]=[0.2,0.3,-0.6,-0.1]

 Y=Yin1+Yin2

 {Yin1b=0.5 - calculate the net output

 {Y2b=0.9- Activation- Binary

- Bipolar

 [x1,x2,x3,x4]=[0.5,0.9,0.2,0.3]
 [W1,W2,W3,W4]=[0.2,0.3,-0.6,-0.1]

 b1=0.5

 b2=0.9

For Y1: Yin1=0.5+((0.5*0.2)+(0.9*0.3)+(0.2*-0.6)+(0.3*-0.1))

=0.5+0.1+0.27-0.12-0.03

=0.72

Yin2=0.9+((0.5*0.2)+(0.9*0.3)+(0.2*(-0.6))+(0.3*(-0.1)))

=0.9+0.1+0.27-0.12-0.03

=1.12

Y=Yin1+Yin2=0.72+1.12=1.84
 Binary Sigmoidal

 f(x)=1/(1+(𝑒 −⋋𝑥 ))

 f(x)=1/(1+(𝑒 −1.84 ))

=0.8629

 Bipolar Sigmoidal

 f(x)=(1-(𝑒 −⋋𝑥 ))/(1+(𝑒 −⋋𝑥 ))

 f(x)=(1-(𝑒 −1.84 ))/(1+(𝑒 −1.84 ))

=0.7258 =0.726

PERCEPTION NETWORK (Implementation of neural network )

 Perceptual Network comes under single layer feedforward network which is one of the
implementation of artificial neural network.

 The perception network consists of 3 units-

 -Sensory unit(Input)

 -Associator unit(Hidden unit)

 -Response Unit(Output)

 The sensory units are connected to associator units with the fixed weights having values
1,0 or -1.

 The binary activation function is used in sensory unit and associative unit.

 The response unit has an activation of 1 ,0 or -1 which is connected to the sensory unit
through the associative unit.

 The output of the perception network is given by-

 Y=f(yin)

 f(yin)={1 if yin > Ѳ

={0 if –Ѳ << yin << Ѳ Where Ѳ is the threshold value

={-1 if yin <- Ѳ


 The perception learning is used in the net updation between the associator unit and the
response unit.

 For each training input, the net will calculate the response and it will determine whether
or not an error has occurred.

 The error calculation is based on the comparison of the target values (training data)with
the calculated output.

 The weights will be adjusted on the basis of the learning rule if an error has occurred for
a particular training pattern.

 Wi(new)=Wi(old)+αtxi

 bi(new)=bi(old)+αt

where α = learning rate

 Perception network can be of the single class means only 1 single output neurons and
the perception network can be of multiple class means many outputs neurons will be
compromise of a single y.
FLOW CHART OF TRAINING PROCESS FOR SINGLE OUTPUT NEURONS
Learning process in the neural network

 The main property of a neural network is the capability to learn.

 Learning-Learning /training is a process by means of which a neural network adapts


itself to stimulate by making proper parameter adjustments.

 There are 3 types of learning

1. Supervised learning

2. Unsupervised learning

3. Perception /Reinforcement learning

Supervised Learning

 In supervised learning each input vector requires a corresponding target vector which
represents the divided output.

 The input vector along with the target vector is called the training pair.

 In this type of learning process a supervisor is required for error submission.

 In supervised learning it is assumed(predicted) that the correct target values are known
for each input pattern.


Unsupervised Learning
 In unsupervised learning, the input vector requires its corresponding vector which
represents the desired output.
 The input vector along with the target value is called Training pair.
 Here, no supervisor required for the error minimization.


Perception/Reinforcement Learning

 In this type of learning, after getting the actual output, the output neuron will send a
feedback to its respective input signal that the work which you have assigned it has
been completed.
Perception training algorithm for single output class

 Step-1- xi=each possible inputs

s=set of inputs

Start the perception process.

 Step-2-Initialize the set of inputs i.e;set of weight(w) with its respective bias(b).

 Step-3-Input the set the learning rate(α) within its limit from 0 to 1.

 Step-4-Mapping is done for each set of input(s) with each set of target value. If all the
set of input is mapped with the set of target value then activate the input units i.e; map
the number of inputs with the values else go to step-9.

 Step-5-Calculate the net input using bias i.e;

 Yin=b+∑𝑛𝑖=1 𝑥𝑖𝑤𝑖

 Step-6-Obtain using the activation functions (i.e;bipolar /binary etc) and obtain the
desired output.

 y=f(yin)

={ 1 if yin > Ѳ

 f(yin) ={0 if –Ѳ <<yin <<Ѳ

={-1 if yin <-Ѳ

 Step-7- If y !=t, then

Wi(new)=Wi(old)+αtxi

b(new)=b(old)+ αt

else

Wi(new)=Wi(old)

bi(new)=bi(old)

 Step-8- If weight changes then go to step-4 else

 Step-9- STOP
Adaline Network
 A network with a single linear unit is called as Adaline.

 In Adaline network, the input output relationship is linear.

 Adaline uses bipolar activation function for its input signals to reach at its target output.

 The weights between the inputs and outputs are adjustable.

 Adaline is a network which have one output unit.

 The adaline network may be trained by using Δ-rule.

 The Δ-rule updates the weights between the connection so as to minimize the
difference between the net input to the output unit and the target value.

 The Δ rule for adjusting the weights of ith pattern means i=1to n

i.e; Δ Wi=α(t-yin)xi

Where Δ Wi->weight change , α->learning rate ,xi->vector of activation of input unit , yin->net
input to the output unit

Y=∑𝑛𝑖=1 𝑥𝑖𝑤𝑖 + 𝑏 ------target output

 The Δ- rule in case of several output unit for adjusting the weights from ith input units
jth output unit for each pattern.

 Δwij=α(tj-yinj)xi
Flow chart
Algorithm
 Step-1:-Start the initial process.

 Step-2:-Initialize the values of weight, bias and learning rate i.e;w,b,α respectively.

 Step-3:-Give the output of tolerance error (E)i.e; the maximum error capacity that the
system hold.

 Step-4:-For each input sets , if there is matching output set then goto step-5.

Else goto step-10

 Step-5:-Activate the input means gives the input to each neuron from the input set , i.e;
from xi to si

where i1 to n
 Step-6:-Calculate the net input i.e;

Y=∑𝑛𝑖=1 𝑥𝑖𝑤𝑖 + 𝑏

 Step-7:- Update the weights and bias as:-

Wi(new)=Wi(old)+Δwi

=>Wi(new)=Wi(old)+α(t-yin)xi

=>bi(new)=bi(old)+α(t-yin)

 Step-8:-Check the total error at the output unit.

Ei=∑(t-yin)^2

 Step-9:-If (Ei==Es)

then goto step 10 else goto step 4

 Step-10:-STOP

Perception training algorithm for multiple output


 Step-1:- Start the perception process.

 Step-2:-Initialize the set of inputs i.e;set of weights (w) with its respective bias.

 Step-3:-Input the set of learning rate(α) within its limit from 0 to 1.

 Step-4:-Mapping is done for each set of input (s) with each set of target value.

 If all the set of target value then activate the input units i.e; map the number of inputs
with the values else goto step-9.

 Step-5:-Calculate the output of

the network.

Yinj= ∑𝑛𝑖=1 𝑥𝑖𝑤𝑖 + 𝑏 𝑗

where i=1 to n, j=1 to m

 Step-6:-The final output using activation functions are:-

Yj=f(yinj)
={ 1 if yinj > Ѳ

 f(yin) ={0 if –Ѳ ≤yinj ≤Ѳ where i=1 to n, j=1 to m

={-1 if yinj <-Ѳ

 Step-7:-if tj!=yj then;

Wij(new)=Wij(old)+αtjxi

bj(new)=bj(old)+αtj

Else

Wij(new)=Wij(old)

bj(new)=bj(old)

 Step-8:-If weight changes then go to step-4

 Step-9:-STOP

Back-propagation Network(imp)
In this ,the network signals are sent in the reverse direction.

It means whatever the signals sent by the input neurons it can get its feedback in the reverse
direction to inform the completion of task.

Its respective elements are :-

x=Input training vector (x1,x2…..xi……xn)

t= target output vector(t1…….tk……..tm)

α=Learning rate parameter

xi= input unit “i” where {i=1 to n}

Voj=bias m the jth hidden unit {j=1 to p}

Wok=bias m the kth output unit {k=1 to m}

Zj=hidden unit j
Flow chart of perception training algorithm for multiple output class
 Zinj=V0j+ ∑𝑛𝑖=1 𝑥𝑖𝑣𝑖𝑗 the net input of zj

 The total output is Zj=f(Zinj)

 Calculation at the hidden layer which the final output will be forwarded to the output
layer

 Output layer:-

 Yk=the output at the kth unit

 Yjpk=Wok+ ∑𝑝𝑗=1 𝑍𝑧𝑊𝑗𝑘

 The total output is :

 Yk=f(Yjpk)
How to calculate error :-
 δk=Error correction

Weight adjustment forWjk i.e; due to an error at

Output unit Yk

 δj=Error correction

weight adjustment for Vij due to back propagation of error in the hidden unit

i.e;Zj
Algorithm:-
 Step-1:-Start the perception process.

 Step-2:-Initialize the weight to some random values.

 Step-3:-For each training pair, the set of input values(x)will be mapped with the set of
target values(t)

Map the number of inputs with the values else goto step-11(receive the input signal (xi) and
transmit it to the hidden layer)
 Step-4:-If the input signals are received ,then the output is calculated in hidden unit
area.

Zinj=Voj+ ∑𝑛𝑖=1 𝑥𝑖𝑉𝑖 𝑗

Zj=f(Zinj)

Where j =1 to p, i=1 to n

 The final output from the hidden layer is then transmitted to the output layer.

 Step-5:-Output layer calculates the final output :

Yink=Wok+ ∑𝑝𝑗=1 𝑍𝑗𝑊𝑗𝑘

Yk=f(yink) where k=1 to m

 Step-6:-Target pair “A” enters (the target value). Now the output is being mapped with
the target values.

(Error correction factor)fk=(tk-yk)f’(yjpk)

 Step-7:-If the error is being calculated, then find the weight and bias:-

 ΔWjk=αδkZj;

 ΔWok=αδk;

 Where ΔWjk=change factor in weight from hidden to the output layer

 Δwok=change in bias in the output unit

 Step-8:-Then calculate the error correction term:-

(inbetween input and hidden layer)

δinj=∑𝑚
𝑘=1 δ𝑘𝑊𝑗𝑘

δj= δinj f’(zinj)

 Step-9:-Calculate the error in weight and bias in hidden unit:-

𝛥𝑉𝑖𝑗 = αδjxi

𝛥𝑉𝑜𝑗= αSj

 Step-10:-After the calculation again:-update the weight and bias the output unit as:-
Wjk(new)=Wjk(old)+ΔWjk

Wok(new)=Wok(old)+ ΔWok

 Step-11:-Update the weight and bias on the hidden unit as :-

Vij(new)=Vij(old)+ Δ Vij

Voj(new)=Voj(old)+ Δ Voj

 Step-12:- If the target matches the output then STOP else goto step-6

Q)Implement the AND function using perception network for bipolar inputs and targets (imp)
Q)Implement the OR operation using network for bipolar input and targets(imp)
Kohonen-Self Organizing Features Maps(v.imp)

 A self organizing map/self organizing feature map is a type of artificial neural network
which is trained using unsupervising learning process to produce a low-dimentional ,
discretized representation of the input space of the training samples is a map.

 Self organising maps differ from other artificial neural network because they apply
complicated learning process to produce the error correction to get the output.

 For this reason, this map use a neighborhood function to preserve the topological
properties of input space.
 Consider a linear array of cluster units.

 The neighborhoods of this units are designed by “0” of radius Ni(k1),Ni(k2) & Ni(k3)
where k1>k2>k3 where : k3=0,k2=1,k1=2.

 “#” symbol is the winning units and are indicated by “0”.

 For a rectangular grid, each unit has 8 nearest neighbors but in hexagonal grid all can
take only 6 nearest neighbors.
Algorithm

 Step-1:- Start the initial process.

 Step-2:-Initialize the learning rate and weight for each given input ‘x’ at particular time interval
‘t’ i.e; x(t).

 Step-3:-If each input have corresponding update values then goto next(step-4) else goto Step-14

 Step-4:-for i<-1 to n

 Step-5:-for j<-1 to m

 Step-6:-Calculate the Euclidean distance for each j=1 to m.


2
 Dj = ∑𝑛𝑖=1 ∑𝑚
𝑖=1(𝑥𝑖 − 𝑤𝑖𝑗)

2
 Dj = ∑𝑛𝑖=1(𝑥𝑖 − 𝑤𝑖𝑗)

 Step-7:-Calculate the winning unit under ‘j’ i.e; the minimum distance among the number of
distances.

 Step-8:-Then upon the updated winning unit, Calculate the new weight as:

 Wij(new)=Wij(old)+α[xi-Wij(old)]

 Step-9:-Do it for each j<-1 to m.

 Step-10:-Continue it for each i->1 to n.

 Step-11:-Reduce the learning rate by: α= α(t+1)

 => α=0.5 α(t)

 Update the new learning rate by reducing the old, the old takes the time ‘t’ & next the time will
increase to t+1, alternatively the learning rate will be decreased.

 Step-12:-To find the shortest path, the system will make a network topology structure.

 For that reason by exploring one node then the path starts from another node , in that’s why
the radius will be reduced.

 Step-13:-Test for (t+1)=reduced to specified level i.e; it test within a time constraint the
minimum path will explore or not. If it can do so then go to Step-4. Else goto step-3.

 Step-14:-STOP
Linear Vector Quantization
 LVQ is a process of classifying patterns where each input unit represents a particular
class.

 It is likely to supervised learning which is simiar to KSOFM[Kohonen-self Organizing


Feature maps] where each output unit has knowledge about a known class represents a
set of input units.

 Parameters used are:-

 x=training vector(x1,x2…….xi,……xn)

 T=category or class for the training vector “x”

 Wj=weight vector for jth output unit

 Cj=cluster or class associated with jth output unit


Algorithm
 Step-1:-Start the initial process

 Step-2:-Initialize the weights of the learning rate α

 Step-3:-Enter each input vector ‘x’ to calculate the winner unit “j”

 Step-4:-If Dj=minimum and the target value=cluster

 Update eights:-

 Wj(new)=Wj(old)+ α[(x-Wj(old))]

 Step-5:-Reduce the learning rate by α=0.5 αt

 Step-6:-If the ‘α’ value is negligible then (match with output) goto next.

 Else goto 3

 Step-7:-STOP

 Q)Find the new weights using back propagation networks for the network shown in
figure, the network is represented in input patter=[-1,1]

 Target output=+1

 Use learning rate α=0.25 & using bipolar sigmoidal activation function.


 Initial weight:-

 [V11,V21,V01]=[0.6,-0.1,0.3]

 [V12,V22,V02]=[-0.3,0.4,0.5]

 [W1,W2,W3]=[0.4,0.1,-0.2]

 Α=0.25

 Input Unit:-

 [x1,x2]=[-1,+1]

 Target t=+1

 Calculate the net input z:-

 Zin1=x1V11+x2V21+V01 =0.6-0.1+0.3=-0.4

 Zin2=x1V12+x2V22+V02=-0.3+0.4+0.5=1.2

 Output:-

 Z1=f(Zin1)=1 − 𝑒 −𝑧𝑖𝑛1/(1 + 𝑒 −𝑧𝑖𝑛1 )=1-𝑒 0.4 /(1+𝑒 0.4 )

 =0.1974

 Z2=0.537

 Calculate the net input to the output layer:

 Fin=w0+z1w1+z2w2=-0.2+(-0.1974*0.4)+(0.537*0.1)

 =-0.22526

 y=f(yin)=1-𝑒 −𝑦𝑖𝑛1/(1 + 𝑒 −𝑦𝑖𝑛1 )

 =1-𝑒 −0.22526 /(1+𝑒 −0.22526 )=0.1122

 Compute the error portion(δk)

 δk=(tk-yk)f’(yink)=(tk-yk)f’(yin)

 f’(yin)=0.25[1+f(yn)]*[1-f(yn)]=0.5[1+0.1122]*[1-0.1122]

 =0.4937
 f’(yin)=0.4937

 δ1k = (1+0.1122)*0.4937=0.5491

 Find the changes in weight between output to hidden:-

 Δw1= α δ1z1=0.25*0.5491*0.1974=-0.02701

 Δw2=α δ1z2=0.25*0.5491*0.537=0.0737

 Δw0=α δk=0.25*0.5491=0.1373

 Compute the error portion δj between hidden to input where j=1 to 2.

 δin1= δ1W11=0.5491*0.4=0.21964

 δin2= δ1W21=0.5491*0.1=0.05491

 Error:-

 δ1 =δin1f’(zin1)=0.21964*0.5*(1+0.1974)(1-0.1974)=0.1056

 δ2 =δin2f’(zin2)=0.5491*0.5*(1+0.537)(1-0.537)=0.0195

 Now find the changes in weights in input and hidden.

 V11= α δ1 x1=0.25*0.1056*(-1)=-0.0264

 V21= α δ1 x2=0.25*0.1056*1=0.0264

 V01= α δ1 =0.25*0.1056=0.0264

 V12= α δ2 x1=0.25*0.0195*(-1)=-0.0049

 V22= α δ2 x2=0.25*0.0195*(+1)=0.0049

 V02= α δ2=0.25*0.0195=0.0049

 Compute the final weight of the network:-

 V11(new)=V11(old)+ΔV11=0.6+(-0.0264)=0.5736

 V21(new)=V21(old)+ΔV21=(-0.1)+0.0264=-0.0736

 V01(new)=V01(old)+Δ V01=0.3+0.0264=0.3264

 V12(new)=V12(old)+Δ V12=(-0.3)+(-0.0049)=-0.3049
 V22(new)=V22(old)+Δ V22=0.4+0.0049=0.4049

 V02(new)=V02(old)+Δ Vo2=0.5+0.0049=0.5049

 W1(new)=W1(old)+Δ W1=0.4+(-0.0271)=0.3729

 W2(new)=W2(old)+ Δ W2=0.1+0.0737=0.1737

 W0(new)=W0(old)+ ΔW0=(-0.2)+0.1373=-0.0627

 After updating all the weights of the network the target given for each set of input will
be automatically matched to the desired output at the single output neuron i.e;y.

Adaptive Neuro-Fuzzy Interface System(ANFIS)

 It is a kind of artificial neural network based on Takagi-Sugeno Fuzzy Interface System.

 It integrates both neural networks and fuzzy logic principles.

 This inference system corresponds a set of fuzzy if-then rules that have learning
capability to approximate non-linear functions.
It consists of 5 layers.

 Layer-1-(Membership Function Layer)

 It is known as membership function layer.

 In this layer every node ‘i’ will be calculated upon the membership function value “μ”

 i= μ Ai(x) {for x input}

 i= μ Ai(x) {for y input}

 For i=A1 to A2 , i=B1 & B2

 Here at this input layer (layer 1), the total set of input will be calculated upon 4 fuzzy
sets. A1,A2 & A3-A4 by the formula

 Layer-2-

 It is known as rule layer.

 In this layer 2 make the product of 2 incoming signals.

 O2->output of the layer 2


 Layer-3-

 It is also known as the non-linear layer.

 It is based upon finding out the final weight i.e;Ŵ1 and Ŵ2

 O3=wi=wi/(w1+w2)

 where i=1,2

 i=3,4

 Layer-4-

 It is known as the prior of the output layer.

 Every node ‘i’ in this layer is an adoption node with a node function.

Layer-5-

 This is the final layer of the adoptive system which computes the overall output as the
submission of all incoming signals interms of the final output i.e; ‘f’.

 (the final output will be interms of the fuzzy )


MODULE-4

Genetic Algorithm

 Definition:

 If Genetic algorithm is a heuristic search method used in artificial intelligence and computing.

 It is used for finding optimizing solution to search problems based on the theory of natural
selection and evolutionary biology(concept of neural network).

 Genetic algorithm are excellent for searching the large and complex data sets.

Basic Terminology

 Population:-It is a subset of all the possible encoded solution to the given problem.

 Chromosomes:-It is one such solution to the given problem.

 Gene:-It is one element position of a chromosome.

 Allele:-(exact value of particular gene)-It is the value of a gene takes for a particular
chromosome.

 Genotype:- It is the population in the computation space in the computation space, the solution
are represented in a way which can be easily understood and manipulated using a computing
system.

 Phenotype:- It is the population in the actual real world solution space in which solution are
represented in a way they are represented in a real world situations.


 Fitness Function:- A fitness function f(x) simply defined as a function which takes the solution as
input and produce the suitability of the solution as the output.

 Genetic operators:-These alter the genetic composition of the offspring. These crossover
mutation, selection etc.

GA()

 Initialize population.

 Final fitness of population

 While (termination criteria is reached)

 Do parent selection

 Crossover with probability-PC

 Mutation with probability-PM

 Decode and fitness calculation

 Survivor selection

 Find best

 Return best
Operators in Genetic Algorithm
 Encoding is a process of representing individual genes.

1. Binary encoding(binary string)

2. Octal encoding(octal numbers)(0-7)

3. Hexa-decimal encoding(hexadecimal nos)(0-9.A-F)

4. Permutation Encoding(integer/real number)

5. Value encoding(every chromosome is a string of values and the values can by anything
connected to the problem) it is the best to give result

The encoding(solving program expression for genetic programming. Every chromosome is a tree of
some objects such as functions and commands of programming language)
Crossover: (Recombination)

 It is the process of taking 2 parent solutions producing from them a child.

1. Single Point Crossover:-

A point on both parents chromosomes is picked randomly and designated a


crossover point bits to the right of that point are swapped between the two
parent chromosomes.

This result in 2 offspring each carrying some genetic information from both
parents.

2.Two-point crossover:-
 Two crossover points are picked randomly from the parent chromosomes .

 The bits in between the two points are swapped between the parent organisms.

 It is equivalent to performing two single-point crossovers with different cross points.

3. Multipoint crossover
 More than one points crossover will initiated between 2 points.
4. Uniform Crossover:-
If 1st bit of mask is 1, then crossover will be done from parent 1 side, if 2 nd bit is 1 then
crossover will be done from parent2 side.

5.Three point crossover:-


 It allow at time three parent crossover, but the process will be at time in between 2
parents.

Mutation Operation:-
 After crossover, the strings are subjected to mutation.

 Mutation of a bit involves flipping it changing 0 to 1 and vice versa with a small mutation
probability PM.
 Mutation Rate:-

 It is the probability of mutation which is used to calculate number of bits to be mutated.

1. 1’s complement operator

a=0100 0001 ->4 1

-a=1011 1110 ->11 14

1. Logical bit-wise operator

1. Bit wise AND(&) operator

2. Bit wise OR(^) operator

 Shift left Operator:-

 a-> 1010 0110 ->10 6

 a<< 2->1001 1000->9,8

 Shift right operator:-

 a= 1010 0110 ->10,6

 a>>2=0010 1001 ->2,9

 Parent 1a=10101010 ->10,13

 Parent 2b=11000011->12,3

 AND : child a&b =10000010 ->8 2

OR: child a^b = 01101001 ->6 9

Difference between Genetic Algorithm and traditional algorithm:-


 Genetic algorithm is based on the principle of genetics and natural selection to solve
optimization problems.

 While traditional algorithm is step by step procedure to follow in order to solve a given
problem.
 GA uses population of solution rather than a single solution for searching. It improves
the chance of reaching the global optimization.

 GA uses fitness function for evaluation rather than derivations.

 GA’s use prabalistic transaction operates while conventional methods is used for
continuous optimization.

Problem solving using Genetic algorithm

 Q-Consider the problem of minimizing the function f(x) =𝑥 2 where x is permitted to vary
between 0 and 31.

 2=(625/1155)=0.5411

 3=(25/1155)=0.0216

 4=0.3255

 Expected count= (f(x)i)/(Avg(f(x)i))

 1={(144)/(1155/4)}=144/288.75=0.4987

 2=625/288.75=2.164

 3=25/288.75=0.0866

 4=361/288.75=1.2502

 Step-6- Now the actual count is to be obtained to select the individuals who would
participate in the cross-over cycle using Roulette wheel selection procedure.
 Step-7-The Roulette wheel selection procedure will be forward with a entire Roulettee
wheel covers 100%.

Roulette Wheel:-
 According to Roulette wheel :- Selection Actual count

54.11% 2

31.26% 1

12.47% 1

2.16% 0

 After the selection process:

Final output after mutation

You might also like