Soft Computing Unit I
Soft Computing Unit I
Soft Computing Unit I
Unit I
Introduction to Soft
Computing
Introduction to Soft Computing
Concept of computation
Hard computing
Soft computing
How soft computing?
Hybrid computing
CONCEPT OF COMPUTATION
Antecedent Consequent
Control Action
Figure: Basic of computing
Important characteristics of
computing
Should provide precise solution.
Soft
⋮ computing
Soft
Bank with maximum return
computing
HC SC
Hybrid computing
Yes or No
Crisp answer
True or False
Yes
A
Crisp
Milk/Water liquid
N
o
Is the liquid
colorless?
Example : Fuzzy logic vs. Crisp logic
May be
May not be
Partially
etc
Example : Fuzzy logic vs. Crisp logic
Score
99
Extremely honest
Ankit
Rajesh
Very honest 75
Santosh
Fuzzy
Kabita 55
Honest at times
Extremely dishonest 35
Is the person
honest?
World is fuzzy!
Our world is
better
described
with fuzzily!
Concept of fuzzy system
Fuzzy
element(s)
I Fuzzy set(s)
N
P
U Fuzzy rule(s)
T
Fuzzy implication(s) O
(Inferences) U
T
P
Fuzzy system U
T
Concept of fuzzy set
To understand the concept of fuzzy set it is better, if we first
clear our idea of crisp set.
X = The entire population of India.
H = All Hindu population = { h1, h2, h3, ... , hL }
M = All Muslim population = { m1, m2, m3, ... , mN }
Universe of X
discourse
H
M
1. S = { s | s ∈ X } 1. F = (s, µ) | s ∈ X and
µ(s) is the degree of s.
2. It is a collection of
elements. 2. It is collection of
ordered pairs.
3. Inclusion of an el- 3. Inclusion of an el-
ement s ∈ X into S is ement s ∈ X into F is
crisp, that is, has strict fuzzy, that is, if present,
boundary yes or no. then with a degree of
membership.
Fuzzy set vs. Crisp set
Example:
H = { (h1, 1), (h2, 1), ... , (hL, 1) }
Person = { (p1 , 1), (p2 , 0), ... , (pN , 1) }
In case of a crisp set, the elements are with extreme values
of degree of membership namely either 1 or 0.
lore y
EX = Marks ≥ 90
A = 80 ≤ Marks < 90
B = 70 ≤ Marks < 80
C = 60 ≤ Marks < 70
D = 50 ≤ Marks < 60
P = 35 ≤ Marks < 50
F = Marks < 35
Example: Course evaluation in a crisp way
1 F P D C B A EX
0
3 5 6 7 80 90
5 0 0 0 100
Example: Course evaluation in a fuzzy way
F P D C B A EX
1
0
3 5 6 7 80 90
5 0 0 0 100
Few examples of fuzzy set
High Temperature
Low Pressure
Color of Apple
Sweetness of Orange
Weight of Mango
Note:
µA(x) map each element of X onto a membership grade (or
membership value) between 0 and 1 (both inclusive).
Question:
How (and who) decides µA(x) for a Fuzzy set A in X ?
Some basic terminologies and notations
Example:
x=All cities in India
A=City of comfort
A={(New Delhi,0.7),(Banglore,0.9),(Chennai,0.8),(Hydrabad,0.6),
(Kolkata,0.3),(Kharagpur,0)}
Membership function with discrete membership
values
Membership function with discrete membership
values
A ={(0,0.1),(1,0.30),(2,0.78)……(10,0.1)}
1.0
0.8
0.6 Note : X = discrete
µ
value
0.4
0.2
How you measure happiness ??
0 2 4 10
6 8
A = “Happy family”
Membership function with continuous
membership values
1.0
0.8
B (x) 1
4
0.6
x 50
1
10
0.4
0.2
0 50 10
0 B
Age (X)
Note : x = real value
B = “Middle aged” = R+
Fuzzy terminologies: Support
A
Fuzzy terminologies: Core
1.0
µ
0.5
x
Fuzzy terminologies: Normality
1.0
Fuzzy terminologies: Crossover points
Aα = { x | µA (x) ≥ α }
Aα ’ = { x | µA (x) > α }
Note :
• A is convex if all its α- level sets are convex.
• Convexity (Aα)function
Membership
=⇒ Aα is composedNon-convex
of a single line
segment only.
is convex Membership
function
1. 1.
0 0
Fuzzy terminologies: Bandwidth
Bandwidth :
For a normal and convex fuzzy set, the bandwidth (or width)
is defined as the distance the two unique crossover points:
Bandwidth(A) = | x1 - x2 |
where µA(x1) = µA(x2) = 0.5
Fuzzy terminologies: Symmetry
Symmetry :
1.0 1.0
0.8 0.8
0.6 0.6
µA
µB
0.4 0.4
0.2 0.2
0 10 20 30 40 50
0 2 4 6 8 10
60
µ
µ
x x x
x x
1.0
a b c
Fuzzy MFs: Trapezoidal
A trapezoidal MF is specified by four parameters {a, b, c,
d } and can be defined as follows:
1 if x ≤ a
x −a if a ≤ x
≤b
b−a
trapeziod (x ; a, b, c, (2
2 if b ≤ x ≤ c
d) = d )
d−x
−c if c ≤ x ≤ d
0 if d ≤ x
1.0
a c d
b
Fuzzy MFs: Gaussian
—12 ( x − c 2
gaussian(x;c,σ) ) .
σ
=e
c
0.
0.1 0.9
1 c c
Fuzzy MFs: Generalized bell
bell(x; a, b, c)= 1
1+| x −a c |
2b
b
Slope at x
= 2a
b
Slope at y =
x b y
2a
c- c c+
a a
Example: Generalized bell MFs
1
Example: 1+ 2
;
µ(x)=
a = b = 1 and cx =
0;
1.0
-1 0 1
Generalized bell MFs: Different shapes
Changing Changing
a b
Changing
a Changing a and
b
Fuzzy MFs: Sigmoidal MFs
1.
0
Slope =
0.
a 5
c
Fuzzy MFs : Example
Excellent = Marks ≤ 90
Very good = 75 ≤ Marks ≤ 90 Good = 60 ≤ Marks ≤
75 Average = 50 ≤ Marks ≤ 60 Poor = 35 ≤ Marks ≤
50 Bad= Marks ≤ 35
Grading System
1
.8
.6
.4
.2
0
1 2 3 6
40 70 80 90
0 0 0 0
50
marks
You can decide a standard fuzzy MF for each of the fuzzy
garde.
Operations on Fuzzy Sets
Basic fuzzy set operations: Union
Union (A ∪ B):
µA∪B (x ) = max{ µA (x ), µB
(x )}
Example:
A = {(x1 , 0.5), (x2, 0.1), (x3, 0.4)} and
B = {(x 1 , 0.2), (x2, 0.3), (x3, 0.5)};
C = A ∪ B = { (x1 , 0.5), (x2 , 0.3), (x3 , 0.5)}
µB µB
µA
µ
µAU
µA B
b q c b q c
a p a p x
x
Basic fuzzy set operations: Intersection
Intersection (A ∩ B):
µA∩B (x ) = min{ µA (x ), µB (x
)}
Example:
A = {(x1 , 0.5), (x2, 0.1), (x3, 0.4)} and
B = {(x 1 , 0.2), (x2, 0.3), (x3, 0.5)};
C = A ∩ B = { (x1 , 0.2), (x2 , 0.1), (x3 , 0.4)}
µA
µB µAᴖ
µ B
x b q c p b q c
a p a
x
Basic fuzzy set operations: Complement
Complement (AC ):
µAAC (x ) = 1-µA (x
)
Example:
A = {(x1 , 0.5), (x2, 0.1), (x3, 0.4)}
C = AC = {(x
µA 1 , 0.5), (x2, 0.9), (x3, 0.6)}
µA
1.0
µA’
µ
q p x q
p
x
Basic fuzzy set operations: Products
µA•B (x ) = µA (x ) • µB
(x )
µαA (x ) = α · µA (x )
Basic fuzzy set operations: Sum and Difference
Sum (A + B):
µA+B (x ) = µA (x ) + µB (x ) − µA (x ) · µB (x )
Difference (A − B = A ∩ BC ):
µA−B (x ) = µA∩B C (x )
µ|A( x ) g B( x ) | = max{ 0, µA (x ) + µB (x ) − 1}
Basic fuzzy set operations: Equality and Power
Equality (A = B):
µA (x ) = µB (x )
µAα (x ) =
{ µA (x )} α
Example 3:
A(x) = {(x 1 , 0.2), (x2, 0.3), (x3, 0.5), (x4, 0.6)}
B(y) = {(y1 , 0.8), (y2, 0.6), (y3, 0.3)} y1 y3
y2
x1 0.2 0.2 0.2
x2
0.3 0.3
A × B = min{ µA (x ), µB
0.3
x
3 .5 0.5
(y )} = 0 0.3
x4 0.6
0.6 0.3
Properties of fuzzy sets
Commutativity :
Associativity :
A ∪ (B ∪ C) = (A ∪ B) ∪ C
A ∩ (B ∩ C) = (A ∩ B) ∩
C
Distributivity :
A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪
C)
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩
C)
Properties of fuzzy sets
Idempotence :
A ∪ A =
A
A ∩ A =
∅A ∪ ∅
= A A∩
Transitivity : ∅= ∅
If A ⊆ B, B ⊆ C then A ⊆
C
Involution :
(Ac ) c = A
De Morgan’s law :
(A ∩ B) c = Ac ∪ Bc
(A ∪ B) c = Ac ∩ Bc
Few Illustrations on Fuzzy
Sets
Example 1: Fuzzy Set Operations
a4 x
Example 1: Plotting two sets on the same graph
µB µA
µ
b1
a2 b 4 a3 a 4
a1 x
Example 1: Union and Intersection
The plots of union A ∪ B and intersection A ∩ B are
shown in the following.
µB µA
b1
a1
a2 b4 a3 a4 x
A B ( )x
a2 b4 A B ( )x
x b1 a1 a2 a3 a4
x
Example 1: Intersection
( )x
A
a b a b
x x
Fuzzy set operations: Practice
i. A , B
ii. A ∪ B
iii. A ∩ B
iv. (A ∪ B) c [Hint: Use De’ Morgan law]
Example 2: A real-life example
µA µB
1.0
0.5
µ
-15 -10 -5 0 5 10 15 20 25 30 35 40 45 50
A B
0.
5
µ
- -
15 10 -5 0 5 10 15 20 25 30 35 40 45 50
5 15 25 5 25
x
x x
Few More on Membership
Functions
Generation of MFs
Given a membership function of a fuzzy set representing a
linguistic hedge, we can derive many more MFs representing
several other linguistic hedges using the concept of
Concentration and Dilation.
Concentration:
Ak = [µA (x )]k ; k > 1
Dilation:
Ak = [µA (x )]k ; k < 1
Very
Old
Very young
0 30 60 100
X=
Age
Text Books:
5. The processing elements of the ANN have the ability to learn, recall
and generalize from the given data by suitable assignment or
adjustment of weights.
6. the computational power can be demonstrated only by the
collective behavior of neurons, and it should be noted that no single
neuron carries specific information.
Application of Neural Networks
• Photos and fingerprints could be recognized by imposing a fine grid
over the photo. Each square of the grid becomes an input to the NN.
• Lake water level could be predicted based upon precipitation patterns
and river/dam flows.
• Medical diagnosis is an ideal application for NN.
• Scheduling of buses, airplanes and elevators could be optimized by
predicting demand.
• Voice reorganization could be obtained by analyzing the audio
oscilloscope pattern, much like a stock market graph.
• Whether prediction may be possible. Inputs would include weather
reports from surrounding areas. Output(s) would be the future weather
in specific areas based on the input information. Effect such as ocean
currents and jet streams could be included.
• Air traffic control could be automated with the location, altitude,
direction and speed of each radar blip taken as input to the network.
The output would be the air traffic controllers instruction in response to
each blip
Application of Neural Networks
• Appraisal and valuation of property, buildings, automobiles, machinery
etc should be an easy task for a NN.
Disadvantages:
12
Cntd…
• Cell structures
• Soma
• Dendrites
•Axon
• Synaptic terminals
(Synapses)
14
A Typical Nerve Cell
• Dendrite: receives the signals from
other neurons (Accept inputs)
m
y _ ink bk xi .wki bk x1.wk1 x2 .wk 2 ... xm .wkm
i 1
yk f ( y _ ink )
Effect of bias
• The neuronal model also includes
an externally applied bias, denoted
by bk
• The bias bk has the effect of
increasing or lowering the net input
of the activation function, depending
on whether it is positive or negative,
respectively
•The use of bias bk , has the effect of
applying an affine transformation to the
output y_ink of the linear combiner in
the model
• An affine transformation is any
transformation that preserves
collinearity (i.e., all points lying on a line
initially still lie on a line after
transformation)
•Depending on whether the bias bk is positive or negative, the
relationship between the induced local field or activation potential
y_ink of neuron k and the linear combiner output uk is modified
Another nonlinear model of a neuron;
wk0 accounts for the bias bk.
Artificial Neuron Model
m
y _ ink xi .wki (1).wk 0 x1.wk 1 x2 .wk 2 ... xm .wkm
i 0
yk f ( y _ ink )
ANN Topologies
ANN Architectures
1. single-layer feed-forward
network;
2. multilayer feed-forward network or Fully connected feed-
forward network with one hidden layer and one output layer
4. single-layer recurrent network or Recurrent network
with no self-feedback loops and no hidden neurons
n
Si W ji X j
j 1
5. multilayer recurrent network or Recurrent network
with hidden neurons
6. Competitive network
Learning
• The main property of an ANN is its capability to learn
1. Parameter Learning:
It updates the connecting weights in a neural net
2. Structure Learning:
It focuses on the change in network structure
Learning Paradigms
LEARNING WITH A TEACHER (SUPERVISED or ASSOCIATIVE LEARNING )
Error (D-Y)
signals Error signal
D
generator (Desired Output)
Learning Paradigms
LEARNING WITH A TEACHER (SUPERVISED or ASSOCIATIVE LEARNING )
ANN
X W Y
(input) (Actual output)
Reinforcement learning
Neural
Network
W
x (input) Y (Actual output)
Error signal
Error (D-Y) generator
signals R
(Reinforcement
signal)
Reinforcement learning
• Monotonically increasing
• Differentiable
Monotonicity
f(x) = 1, if X > 1
x, if 0 <= x <= 1
0, if x< 0
ACTIVATION FUNCTION
Activation functions:
(A) Identity
(F) Ramp
IMP terminologies in ANN
Weights:
• each neuron is connected to other neurons by means of directed
communication link, associated with weights.
• It contains information about input signal
Threshold:
• It is a set value based upon which the final output of the network may
be calculated.
• It is used in the activation function
• A comparison is made between the calculated net input and the
threshold to obtain the network output.
• For each and every application, there is a threshold limit.
1ifnet
f (net )
1ifnet
IMP terminologies in ANN
Weight matrix or weight connection matrix:
Learning rate:
• The learning rate is denoted by "a." It is used to ,control the amount of
weight adjustment of at each step of training.
• The learning rate, ranging from 0 to 1, determines the rate of learning
at each time step.
IMP terminologies in ANN
Bias:
The bias included in the network has its impact in calculating the net
input. The bias is included by adding a component x0=1 to the input
vector x. Thus, the input vector becomes,
X=(1, x1,x2,…,xn) c(Bias)
weight m
input X Y y = mx+c
n
yinj xi wij x0 w0 j x1w1 j x2 w2 j ... xn wnj
i 0
n
w0 j xi wij
i 1
n
b j xi wij
i 1
Advantages of bias over threshold
All but one neuron are excitatory (tend to increase voltage of other cells)
• Each connection
path is either
excitatory, with
weight w > 0, or
inhibitory, with
weight - p (p > 0)
Cntd…
• The condition that inhibition is absolute requires that theta
for the activation function satisfy the inequality
nw p
• Y will fire if it receives k or more excitatory inputs and no
inhibitory inputs, where
kw (k 1) w
• The output is
n
yin b xi wi
i 1
• There exists a boundary between the regions where yin>0 & yin<0.
This region may be called as decision boundary & can be determined
by the relation n
b xi wi 0
i 1
• If there exists weights with bias for which the training input vectors
having +ve response +1, lie on one side of the decision boundary & all
the other vectors having –ve response -1, lie on the other side of the
decision boundary then we can conclude the problem is “linearly
separable”.
yin b x1w1 x2 w2
b x1w1 x2 w2 0
Cntd…
• If w2 is not equal to 0 then w1 b
x2 x1
w2 w2
x1w1 x2 w2
w1
x2 x1 ( withw2 0)
w2 w2
AND Function using MP
model
AND-NOT Function using
MP model
AND-NOT Function using MP model
XOR Function using MP model
XOR Function using
MP model
XOR Function using MP model
XOR Function using MP model
LINEAR SEPARABILITY: OR Function
LINEAR SEPARABILITY: OR Function
Linear neuron model : application of linear
neuron for linear regression,
Linear Regression:
• In statistics, linear regression is an
approach to modeling the relationship
between a scalar variable y and one or
more explanatory variables denoted X.
• Once we know the equation of this
fitted line we can use it to find y given
X.
• Say , we have conducted an
experiment that gives us some output
value for a set of inputs.
• There are various conventional
methods to do this ,e.g. Ordinary least
squares.
• The best fit line has equation :
Y = mX + c
• We have a choice of two parameters:
m and c
Cntd…
• A linear neuron can be used for this task
since output of a linear neuron is:
• Y2 = w20 (w0) + x1.w21(w1)
• If we keep x0 = 1, then w21 or w1 is slope
and w20 or w0 is the intercept, hence we
have to modify w21 or w1 and w20 or w0
to obtain the best fit line.
• If we make a good choice of w21 or w1 and
w20 or w0 our job is over!
• Many real world problems involve more
than one independent variables then the
regression is called multiple regression.
• For example, if we have two independent
variables , then it becomes a 2-D problem,
the new network would different.
• Now, we have to adjust two slopes and one
intercept.
• This can be extended to solve n-
dimensional problems.
Cntd…
• This can be extended to solve n- dimensional problems.
Concept of error energy
x1 w1
w0
w2
x2 n
o
.
. i=0
wi xi
. wn
n
xn 1 if wi xi >0
f(xi)= { i=0
-1 otherwise
Flowchart
Training algorithm:
Problem
Problem
Problem
Problem
Thank you