Soft Computing: by K.Sai Saranya, Assistant Professor, Department of CSE
Soft Computing: by K.Sai Saranya, Assistant Professor, Department of CSE
By
K.Sai Saranya,Assistant Professor,Department of CSE
UNIT-1
INTRODUCTION TO
ARTIFICIAL NEURAL
NETWORKS
(ANN)
Outline
Artificial Neuron
Applications of ANN
lion
bird
What is that?
Neural networks to the rescue…
5
Definition of ANN
“Data processing system consisting of a
large number of simple, highly
interconnected processing elements
(artificial neurons) in an architecture inspired
by the structure of the cerebral cortex of the
brain”
6
Inspiration from Neurobiology
Human Biological Neuron
7
Biological Neural Networks
Biological neuron
Biological Neural Networks
An artificial neuron
11
Artificial Neurons
Four basic components of a human biological The components of a basic artificial neuron
neuron
13
Model Of A Neuron
Wa
X1
Wb Y
X2 f()
Wc
X3
15
• Each neuron has an internal state, called
its activation or activity level, which is a
function of the inputs it has received.
Typically, a neuron sends its activation as
a signal to several other neurons.
17
Artificial Neural Network
Synapse Nukleus
w1
x1
y
Axon
x2 w2 Activation Function:
yin = x1w1 + x2w2 (y-in) = 1 if y-in >=
and (y-in) = 0
Dendrite
-A neuron receives input, determines the strength or the weight of the input, calculates the total
weighted input, and compares the total weighted with a value (threshold)
- If the total weighted input greater than or equal the threshold value, the neuron will produce the
output, and if the total weighted input less than the threshold value, no output will be produced
18
History
• 1943 McCulloch-Pitts neurons
• 1949 Hebb‟s law
• 1958 Perceptron (Rosenblatt)
• 1960 Adaline, better learning rule (Widrow,
Huff)
• 1969 Limitations (Minsky, Papert)
• 1972 Kohonen nets, associative memory
19
• 1977 Brain State in a Box (Anderson)
• 1982 Hopfield net, constraint satisfaction
• 1985 ART (Carpenter, Grossfield)
• 1986 Backpropagation (Rumelhart, Hinton,
McClelland)
• 1988 Neocognitron, character recognition
(Fukushima)
20
Characterization
• Architecture
– a pattern of connections between neurons
• Single Layer Feedforward
• Multilayer Feedforward
• Recurrent
• Strategy / Learning Algorithm
– a method of determining the connection weights
• Supervised
• Unsupervised
• Reinforcement
• Activation Function
– Function to compute output signal from input signal
21
Single Layer Feedforward NN
x1 w11
w12 ym
w21
yn
x2
w22
output layer
Input layer
V11
x1
w11
w12
V1n
w12 y1
x2 z2
y2
zn
xm Vmn
Input layer Output layer
Hidden layer
Contoh: CCN, GRNN, MADALINE, MLFF with BP, Neocognitron, RBF, RCE
23
Recurrent NN
Input Outputs
Hidden nodes
25
Unsupervised Learning
26
Reinforcement Learning
27
Activation Functions
• Identity
f(x) = x
• Binary step
f(x) = 1 if x >=
f(x) = 0 otherwise
• Binary sigmoid
f(x) = 1 / (1 + e-sx)
• Bipolar sigmoid
f(x) = -1 + 2 / (1 + e-sx)
• Hyperbolic tangent
f(x) = (ex – e-x) / (ex + e-x)
28
Exercise
• 2 input AND • 2 input OR
1 1 1 1 1 1
1 0 0 1 0 1
0 1 0 0 1 1
0 0 0 0 0 0
29
x1 w1= 0.5
y
x2 w2 = 0.3
Activation Function:
yin = x1w1 + x2w2 Binary Step Function
= 0.5,
30
Where can neural network systems help…
• when we can't formulate an algorithmic
solution.
• when we can get lots of examples of the
behavior we require.
„learning from experience‟
• when we need to pick out the structure
from existing data.
31
Who is interested?...
• Electrical Engineers – signal processing,
control theory
• Computer Engineers – robotics
• Computer Scientists – artificial
intelligence, pattern recognition
• Mathematicians – modelling tool when
explicit relationships are unknown
32
Problem Domains
• Storing and recalling patterns
• Classifying patterns
• Mapping inputs onto outputs
• Grouping similar patterns
• Finding solutions to constrained
optimization problems
33
Coronary
Disease
Classification
STOP
01 10
Neural
11
Net 11 10 00 00 Input patterns
00 11
Input layer
Output layer
00 01 10 11
Sorted
00 10 11 patterns
.
00 11 34
Clustering
00 11
10
11 10
00 11
00
01
35
ANN Applications
Medical Applications
Information
Searching & retrieval
Chemistry
Education
Business & Management
Applications of ANNs
• Signal processing
• Pattern recognition, e.g. handwritten
characters or face identification.
• Diagnosis or mapping symptoms to a
medical case.
• Speech recognition
• Human Emotion Detection
• Educational Loan Forecasting
37
Abdominal Pain Prediction
Intensity Duration
Male Age Temp WBC Pain Pain
1 20 37 10 1
adjustable
1
weights
38
Voice Recognition
39
Educational Loan Forecasting System
40
Advantages Of NN
NON-LINEARITY
It can model non-linear systems
INPUT-OUTPUT MAPPING
It can derive a relationship between a set of input & output
responses
ADAPTIVITY
The ability to learn allows the network to adapt to changes in
the surrounding environment
EVIDENTIAL RESPONSE
It can provide a confidence level to a given solution
41
Advantages Of NN
CONTEXTUAL INFORMATION
Knowledge is presented by the structure of the network.
Every neuron in the network is potentially affected by the
global activity of all other neurons in the network.
Consequently, contextual information is dealt with naturally in
the network.
FAULT TOLERANCE
Distributed nature of the NN gives it fault tolerant capabilities
NEUROBIOLOGY ANALOGY
Models the architecture of the brain
42
Comparison of ANN with conventional AI methods
43
UNIT-2
1 wk1
wk2
2
wk3 k
3 wk4
4
• Tasks
– Clustering - Group patterns based on similarity (Focus of this
lecture)
– Vector Quantization - Fully divide up S into a small set of
regions (defined by codebook vectors) that also helps cluster
P.
– Probability Density Approximation - Find small set of points
whose distribution matches that of P.
Network Types for Clustering
• Winner-Take-All Networks
– Hamming Networks
– Maxnet
1 n 1
i pk I k - n k - (n - k ) - n k - n -(n - k )
2 k 1 2
k matches, where each match gives (1)(1) or (-1)(-1) = 1 Neg. Hamming distance
The pattern p* with the largest negative Hamming distance to I is thus the
pattern with the smallest Hamming distance to I (i.e. the nearest to I).
Hence,
the output node that represents p* will have the highest output value of all
Hamming Network Example
P = {(1 1 1), (-1 -1 -1), (1 -1 1)} = 3 patterns of length 3
Inputs Outputs
p1
i1
wgt = 1/2
i2 p2 wgt = -1/2
i3 wgt = -n/2 = -3/2
p3
1
Maxnet
Winning & Learning
``Winning isn’t everything…it’s the ONLY thing” - Vince Lombardi
1 wk1
Note: The use of real-valued
wk2 inputs & Euclidean distance
2 means that the simple product
wk3 k
of weights and inputs does not
3 wk4 correlate with ”closeness” as
in binary networks using
4 Hamming distance.
SCL Examples (1)
6 Cases:
(0 1 1) (1 1 0.5)
(0.2 0.2 0.2) (0.5 0.5 0.5)
(0.4 0.6 0.5) (0 0 0)
Stable attractor
• Input values: (1, 2, 5, 4.5, 4.7) with epsilon = 1/5 and theta = 1
0.000 0.000 2.560 1.960 2.200
0.000 0.000 1.728 1.008 1.296
0.000 0.000 1.267 0.403 0.749
0.000 0.000 1.037 0.000 0.415
0.000 0.000 0.954 0.000 0.207
0.000 0.000 0.912 0.000 0.017
0.000 0.000 0.909 0.000 0.000
Stable attractor
Associative-Memory Networks
Input: Pattern (often noisy/corrupted)
Output: Corresponding pattern (complete / relatively noise-free)
Process
1. Load input pattern onto core group of highly-
interconnected neurons.
2. Run core neurons until they reach a steady state.
3. Read output off of the states of the core neurons.
Inputs Outputs
``When one cell repeatedly assists in firing another, the axon of the first cell
develops synaptic knobs (or enlarges them if they already exist) in contact
with the soma of the second cell.” (Hebb, 1949)
Matrix Memory:
The weights must store the average correlations between all pattern compon
across all patterns. A net presented with a partial pattern can then use the corr
to recreate the entire pattern.
Quantifying Hebb‟s Rule
Compare two nodes to calc a weight change that reflects the state
correlation:
w jk i pki pj
Auto-Association: * When the two components are the same
(different),
increase (decrease) the weight
Ideally, the weights will record the average correlations across all patterns:
P P
Auto: w jk i pki pj Hetero: w jk i pk o pj
p 1 p 1
Hebbian Principle: If all the input patterns are known prior to retrieval time,
then init weights as:
1 P 1 P
Auto: w jk i pki pj Hetero: w jk i pk o pj
P p 1 P p 1
Weights = Average Correlations
Auto-Associative Memory
1. Auto-Associative Patterns to Remember 3. Retrieval
3 4
-1 1 2
1 1 2
3 4 3 4
b
3
Input value
Hopfield Network Example
1. Patterns to Remember 3. Build Network
p1 p2 p3
1/3
1 2 1 2 1 2 1 2
1/3 [-]
3 4 3 4 3 4 -1/3
-1/3 [+]
1/3
3 4
2. Hebbian Weight Init: -1
Avg Correlations across 3 patterns
Boltzmann Machines:
Similar to Hopfield nets but with hidden layers.
State changes occur either:
a. Deterministically when E 0 1
b. Stochastically with probability = 1 e -E /
Where t is a decreasing temperature variable E
and
is the expected change in energy if the change is made.
Fuzzy logic
68
Overview
Future
69
WHAT IS FUZZY LOGIC?
Definition of fuzzy
Fuzzy – “not clear, distinct, or precise; blurred”
Slow Fast
Speed = 0 Speed = 1
bool speed;
get the speed
if ( speed == 0) {
// speed is slow
}
else {
// speed is fast
}
FUZZY LOGIC REPRESENTATION
Slowest
For every problem
[ 0.0 – 0.25 ]
must represent in
terms of fuzzy sets.
Slow
What are fuzzy [ 0.25 – 0.50 ]
sets?
Fast
[ 0.50 – 0.75 ]
Fastest
[ 0.75 – 1.00 ]
FUZZY LOGIC REPRESENTATION
CONT.
Neural Networks
systems.
FUZZY LOGIC IN CONTROL
SYSTEMS
Some Examples
Temperature Controller
Business
Hybrid Modeling
Expert Systems
Fuzzy Logic Example
Automotive Speed Controller
3 inputs:
speed (5 levels)
acceleration (3 levels)
distance to destination (3 levels)
1 output:
power (fuel flow to engine)
Too Too
Slow Optimum Fast
Slow Fast
Speed
1.0
Acceleration
1.0
Very
Close Distant
Close
Distance
Fuzzy Logic Example
Example Rules
IF speed is TOO SLOW and acceleration is DECELERATING,
THEN INCREASE POWER GREATLY
IF distance is CLOSE,
THEN DECREASE POWER SLIGHTLY
...
Fuzzy Logic Example
Note there would be a total of 95 different rules for
all combinations of inputs of 1, 2, or 3 at a time.
( 5x3x3 + 5x3 + 5x3 + 3x3 + 5 + 3 + 3 )
FUZZY AIRTHEMATIC
Definition
• Fuzzy Number
– Convex and normal fuzzy set defined on R
– Equivalently it satisfies
• Normal fuzzy set on R
• Every alpha-cut must be a closed interval
• Support must be bounded
• Applications of fuzzy number
– Fuzzy Control, Decision Making,
Optimizations
Arithmetic Operations
• Interval Operations A = [ a 1 , a3 ] , B = [ b 1 , b3 ]
Addition
[ a1 , a3 ]( )[b1 , b3 ] [ a1 b1 , a3 b3 ]
Subtractio n
[ a1 , a3 ](-)[b1 , b3 ] [a1 - b3 , a3 - b1 ]
M ultiplication
[ a1 , a3 ]()[b1 , b3 ] [ a1 b1 a1 b3 a3 b1 a3 b3 ,
a1 b1 a1 b3 a3 b1 a3 b3 ]
Division
[ a1 , a3 ](/)[b1 , b3 ] [ a1 / b1 a1 / b3 a3 / b1 a3 / b3 ,
a1 / b1 a1 / b3 a3 / b1 a3 / b3 ]
execpt b1 b3 0
Examples
• Addition
[2,5]+[1,3]=[3,8] [0,1]+[-6,5]=[-6,6]
• Subtraction
[2,5]-[1,3]=[-1,4] [0,1]-[-6,5]=[-5,7]
• Multiplication
[-1,1]*[-2,-0.5]=[-2,2] [3,4]*[2,2]=[6,8]
• Division
[-1,1]/[-2,-0.5]=[-2,2] [4,10]*[1,2]=[2,10]
Properties of Interval Operations
Commutative
A B B A A B B A
Assocoative
( A B) C A ( B C ) ( A B) C A ( B C )
Identity 0 [0,0] 1 [1,1]
A A0 0 A A A 1 1 A
Subdistrib utive
A (B C) A B A C
Inverse
0 A-A 1 A/A
M onotonicity for any operations *
If A E and B F then A*B E*F
Arithmetic Operation on Fuzzy
Numbers
• Interval operations of alpha-level sets
( A * B) A* B for any (0,1].
When * /, 0 B for all (0,1].
A* B ( A * B)
(0,1]
iv ) z 7
A (3) B (4) min ( 0.5, 0.8 ) 0.5
Example
• Max (A,B) = { (3 , 1) , (4 , 0.5) }
i) z 2 No such case.
A( ) B ( z ) 0
ii ) z 3
x y 2 3 or x y 3 3
A ( 2) B (3) 1 1 1 A (3) B (3) 0.5 1 0.5
A( ) B (3) (1,0.5) 1
3 2 3
3 3 3
iii ) z 4
x y 2 4 or x y 3 4
A ( 2) B ( 4) 1 0.5 0.5 A (3) B ( 4) 0.5 0.5 0.5
A( ) B ( 4) (0.5,0.5) 0.5
4 2 4
4 3 4
iv ) z 5 No such case.
A( ) B ( z ) 0
Typical Fuzzy Numbers
Triangular Fuzzy Number
Fig. 4.5
Trapezoidal Fuzzy Numbers: Fig. 4.4
Linguistic variable: ”Performance”
Linguistic values (terms):
“very small” … “very large”
Semantic Rules:
Terms maps on trapezoidal fuzzy numbers
Syntactic rules (grammar):
Rules for other terms such as “not small”
Lattice of Fuzzy Numbers
• Lattice
– Partially ordered set with ordering relation
– Meet(g.l.b) and Join(l.u.b) operations
– Example:
Real number and “less than or equal to”
• Lattice of fuzzy numbers
MIN ( A, B)( z ) sup min[ A( x), B( y )] MEET ( A, B)
z min( x , y )
0
10 30 50 70 90 110
Temp. (F°)
Membership Functions
Fuzzification
How cool is 36 F° ?
It is 30% Cool and 70% Freezing
0.7
0.3
0
10 30 50 70 90 110
Temp. (F°)
Fuzzification
Membership Functions
The MATLAB toolbox includes 11 built-in membership function
types. These 11 functions are, in turn, built from several basic
functions:
• piecewise linear functions
• the Gaussian distribution function
• the sigmoid curve
• quadratic and cubic polynomial curves
Fuzzification
Membership Functions
Two membership functions are built on the Gaussian distribution
curve: a simple Gaussian curve and a two-sided composite of two
different Gaussian curves. The two functions are gaussmf and
gauss2mf. The generalized bell membership has the function name
gbellmf.
GENETIC ALGORITHRMS
Introduction
• After scientists became disillusioned with
classical and neo-classical attempts at
modeling intelligence, they looked in other
directions.
• Two prominent fields arose, connectionism
(neural networking, parallel processing)
and evolutionary computing.
• It is the latter that this essay deals with -
genetic algorithms and genetic
programming.
What is GA
• A genetic algorithm (or GA) is a search
technique used in computing to find true or
approximate solutions to optimization and
search problems.
• Genetic algorithms are categorized as global
search heuristics.
• Genetic algorithms are a particular class of
evolutionary algorithms that use techniques
inspired by evolutionary biology such as
inheritance, mutation, selection, and crossover
(also called recombination).
What is GA
• Genetic algorithms are implemented as a
computer simulation in which a population of
abstract representations (called chromosomes
or the genotype or the genome) of candidate
solutions (called individuals, creatures, or
phenotypes) to an optimization problem evolves
toward better solutions.
• Phenotype:
– Physical characteristic of the genotype
(smart, beautiful, healthy, etc.)
Genotype and Phenotype
GA Requirements
• A typical genetic algorithm requires two things to be
defined:
• a genetic representation of the solution domain, and
• a fitness function to evaluate the solution domain.
127