Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
Outline
Overview of soft computing
Neural networks
Fuzzy logic
Introduction to Soft Computing
ECE457 Applied Artificial Intelligence
Spring 2007
Lecture #12
Russell & Norvig, sections 20.5
Russell & Norvig, pages 526-527
Genetic algorithms
Russell & Norvig, pages 116-120
→ ECE 493 & ECE 750 (Prof. Karray)
ECE457 Applied Artificial Intelligence
Soft Computing
“Soft” reasoning
Computer algorithms require complete and
precise information
Page 2
Soft vs. Hard Computing
Branch of AI that deals with systems and
methodologies that can perform approximate,
qualitative, human-like reasoning
Humans can make intelligent decisions using
incomplete and imprecise information
R. Khoury (2007)
Input
Hard Computing Soft Computing
Complete and Approximate and
exact data
incomplete data
Output
Overly-exact
solution
Solution that’s
“good enough”
Reasoning
Rational
Human-like
“Hard” reasoning
Soft computing aims to bridge this gap
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 3
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 4
1
Soft Computing
Probabilistic reasoning
Human brain
R. Khoury (2007)
Page 5
Human Brain
But the brain is intelligent!
Connection patterns of neurons
Amplification of signals by dendrites
Transfer function and threshold values
controlling whether the cell transmits the
signal
ECE457 Applied Artificial Intelligence
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 6
Neurons
Brain learns by changing and adjusting
the connections between neurons
Information encoded in many ways
Neuron is a simple computing
element
Genetic algorithms (GA)
Biological evolution
ECE457 Applied Artificial Intelligence
Massively parallel network of
neurons
Each individual neuron is not
intelligent
Human knowledge
Evolutionary computing
Human Brain
Fuzzy logic (FL)
Human randomness
Artificial neural networks (ANN)
Artificial Neural Networks
R. Khoury (2007)
Page 7
Receives electric impulse from other
neurons through dendrites.
If impulse strong enough, travels
through axon.
Reaches synapses and transmits to
other neurons
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 8
2
Artificial Neuron
Artificial Neural Networks
ith
neuron sums inputs a1… aj… an, weighted
by weights wi1… wij… win
Threshold value θi controls activation
If activated, input is transformed by transfer
function fi(.) into output ai
wij
aj
Cell
body
fi(.)
ai
Synapse
Dendrites
θi
Topology of the network
Transfer function of the neurons
Learning algorithm
Axon
∑
Large arrangement of inter-connected
artificial neurons
Different classes of network
Different networks appropriate for
different applications
ai = fi( ∑jwijaj - θi ) = [0, 1]
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 9
ECE457 Applied Artificial Intelligence
Perceptron
x1
o1
o2
x3
Simplest and most
commonly-used ANN
Feed-forward ANN
Single-layer
Input Hidden Output
layer layer
layer
ECE457 Applied Artificial Intelligence
Page 10
Examples
x2
R. Khoury (2007)
No hidden layer
Only linearlyseparable problems
Multi-layer
Non-linear problems
R. Khoury (2007)
Page 11
x1 1
o
x2 1
All these neurons
use step functions
f(<0) = 0
XOR Network
x1
AND Network
1
-1
f(≥0) = 1
-1.5
1
-0.5
-1
OR Network
x1 1
x2
o
1
-0.5
1
-0.5
o
x2 1
-0.5
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 12
3
Learning
Backpropagation algorithm
ANN Topologies
Train using a set of input-output pairs
Using the entire set = 1 epoch
Supervised learning
Algorithm
Start with random weights
Forward propagation of each input, to get the
network’s output and compute the network error
Back propagate the network error to the output of
each neuron, to get the neuron error
Update the weights of the input of the neuron to
minimise the neuron error
Repeat until min error or max training epoch
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 13
Information can
loop back to create
feedback loop, or
network memory
ECE457 Applied Artificial Intelligence
Basic network
Any transfer functions
Any number of hidden layers
R. Khoury (2007)
x3
x1
o1
x2
x3
R. Khoury (2007)
Page 14
Fully-connected two-layer network
Unsupervised learning
Special class of multi-layer perceptron
Single hidden layer with RBF (typically Gaussian)
transfer function
Hidden neuron transformations are symmetric,
bounded and localized
Useful for modelling systems with complex
nonlinear behaviour, control systems, audio-video
signal processing, …
ECE457 Applied Artificial Intelligence
o1
x2
Kohonen Self-Organising Map
Radial Basis Function (RBF) Network
x1
Feed-Forward Networks
Perceptron
Information can
only move forward
through the
network
Recurrent topology
Feed-Forward Networks
Feed-forward
topology
Page 15
x1
x2
Output neuron compete to activate
Neuron with highest output value wins
Winning neuron and its neighbours
have their weights updated
Creates a 2D topological mapping of
the input vectors to the output layer
Useful for pattern recognition,
image analysis, data mining, …
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 16
4
Recurrent Networks
Hopfield Network
x1
o1
x2
o2
o3
x3
Limits of ANN
First kind of recurrent ANN
Implements an associative
memory
Previous-stored patterns
“complete” current (noisy or
incomplete) pattern
Network is attracted to stable
pattern in memory
Useful for information retrieval,
pattern/speech recognition, …
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 17
Fuzzy Logic
Prone to overfitting
Backpropagation is slow and can
converge on local optimum
Warm
Page 18
Truth value = [0, 1]
This is closer to human knowledge
Cold
Hot
Warm
Hot
1
0
0
Temperature
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
In fuzzy logic, facts can be partially true
and partially false
This is an unnatural way of doing it
Cold
How many hidden layers? How many
neurons per layer? Which transfer
functions?
ECE457 Applied Artificial Intelligence
Truth value = {0, 1}
1
No formal design rules
What does each neuron do? What does
each weight do?
Fuzzy Logic
In crisp logic, facts are either true or
false
Black box
R. Khoury (2007)
Temperature
Page 19
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 20
5
Terminology
Fuzzy Sets vs. Probabilities
“Cold”, “warm” and “hot” are fuzzy set
The triangle function mapping a value
of temperature to a value of cold (or
warm or hot) is called a fuzzy
membership function
The value of cold (or warm or hot) to
which a temperature is mapped is
called a membership degree
Fz[t ∈ Cold] = µCold(t): ℜ → [0,1]
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 21
Fuzzy Rules
If Cold then VentilationHigh
If Warm then VentilationLow
If Hot then VentilationMedium
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
R. Khoury (2007)
Page 22
Typical application of fuzzy logic
Set of fuzzy rules
Define the behaviour of a system
Variables belong partially to antecedent,
therefore consequence activated
partially
ECE457 Applied Artificial Intelligence
Membership degrees are not
probabilities
Both are measures over the range [0,1]
Probabilistic view: x is or is not y, and
we have a certain probability of
knowing which
Fuzzy view: x is more or less y, with a
certain degree
Fuzzy Controller
If-then rules like other logics, but with
fuzzy sets
Page 23
Antecedent: variables that affect the
system
Consequent: reaction of the system
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 24
6
Fuzzy Controller Example
If Hot and Wet then VeryCool
If Warm and Humid then Cool
Hot
1
Fuzzy Controller Example
Wet
1
1
VeryCool
0
1
T
Warm
0
0
H
Humid
1
t
T
0
h
ECE457 Applied Artificial Intelligence
0
1
C
Cool
H 0
R. Khoury (2007)
1
0
C
Page 25
Advantages of Fuzzy Logic
Defuzzification using centroid technique
Converts fuzzy consequent C into crisp
value that can be used by system
Centroid merges the output fuzzy sets
and finds the center of gravity
ECE457 Applied Artificial Intelligence
Page 26
The rule base must be
Be consistent
Not interact
The rule base system must be
Page 27
Complete
Continuous
The rules must
R. Khoury (2007)
R. Khoury (2007)
Properties of Fuzzy Controllers
Partial activation of multiple rules at
once
Achieve complex non-linear behaviour
with simple IF-THEN rules
Use linguistic variables to model words,
rules of thumb, human knowledge
ECE457 Applied Artificial Intelligence
C
c
Robust
Stable
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 28
7
Limits of Fuzzy Logic
Fuzzy Robot Navigation
Writing the fuzzy rules
Designing the fuzzy membership
functions
Often requires work by a domain expert
Fuzzy controllers are very popular for
robot navigation
Eliminates need for complete world
model and complex reasoning rules
Basic robot
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 29
Fuzzy Robot Navigation
ECE457 Applied Artificial Intelligence
1
Medium
Distance: near, medium, far
Direction angle: negative, zero, positive
Speed: slow, medium, fast
Far
1
Negative Zero
Positive
1
Slow
Medium
Fast
0
ECE457 Applied Artificial Intelligence
Direction
0
R. Khoury (2007)
Speed
Page 31
IF (left obstacle is far) and (front obstacle is near) and (right
obstacle is far) and (angle is zero) THEN (left speed is fast)
and (right speed is slow)
Turning corners
IF (left obstacle is medium) and (front obstacle is near) and
(right obstacle is near) and (angle is any) THEN (left speed
is slow) and (right speed is fast)
Following edges
Distance
IF (left obstacle is far) and (front obstacle is far) and (right
obstacle is far) and (angle is zero) THEN (left speed is fast)
and (right speed is fast)
Avoiding obstacles
0
Page 30
Going to target
Near
R. Khoury (2007)
Fuzzy Robot Navigation
Fuzzy linguistic variables of control
system
Known current position and target
Three sensors (front, left, right)
Left and right wheels can turn at different
speeds to make robot turn
IF (left obstacle is far) and (front obstacle is far) and (right
obstacle is near) and (angle is positive) THEN (left speed is
medium) and (right speed is medium)
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 32
8
Fuzzy Robot Navigation
Genetic Algorithms
Biological evolution
Species adapt to better
survive in environment
Over generations
Pairs of individuals
reproduce
Individuals mutate
Fittest individuals
survive and go on to
reproduce
Source: David M. Hillis, Derrick Zwickl, and Robin Gutell, University of Texas.
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 33
Evolutionary Computing
Like simulated annealing!
Divided in four main classes (different
representation of individuals)
R. Khoury (2007)
Page 34
Simulating biological evolution in AI
Biology
Individuals
Environment
Genetic algorithms
Evolution strategies
Evolutionary programming
Genetic programming
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Genetic Algorithms
Introduced by John Holland in “Adaptation in
Natural and Artificial Systems”, 1975
Stochastic search technique
ECE457 Applied Artificial Intelligence
Page 35
Genetic Algorithms
States
Solutions to a problem
State space to explore
Problem to solve
Fitness
Evaluation function
Changes from one
generation to the next
Operators
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 36
9
Individuals
Individuals have a chromosome
String of genes (bits)
Encodes the solution represented by the
individual
Often binary representation, but can be
anything
1
Operators
1
0
0
1
0
1
0
R. Khoury (2007)
Page 37
Crossover
Crossover (sexual reproduction)
Mutation (mutation)
Selection (natural selection)
Length, nature of bits, meaning, varies
according to problem
ECE457 Applied Artificial Intelligence
To evolve, the population must change
GA typically use three operators to
change the population
0 1 0 0 0 1 1 0
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 38
Mutation
Select two fittest parents
Select (random) splitting point in the
chromosomes
Recombine the genes to get children
Causes slow move of the population
around state space
1 1 0 0 1 0 1 0
ECE457 Applied Artificial Intelligence
→
1 1 0 0 0 1 1 0
0 1 0 0 1 0 1 0
R. Khoury (2007)
Page 39
Select random child
Select random gene
Switch gene value according to
mutation rule
Depends on representation
Typically very rare (low mutation rate)
Causes large leap across state space
1 1 0 0 0 1 1 0
↑
ECE457 Applied Artificial Intelligence
→
1 1 0 1 0 1 1 0
R. Khoury (2007)
Page 40
10
Selection
GA population have zero population
growth
Evolution Algorithm
We can’t keep them all (computer limits)
and we don’t want to (they’re useless)
But each crossover operation generates
two more, new individuals
Survival of the fittest!
Evaluate fitness of all individuals
Kill off (i.e. delete) least fit ones,
keeping only the fittest (best solutions)
Each generation, the population improves
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 41
Evolution Algorithm
Starts with random population
Evaluate fitness of all individuals
For each generation
Select fittest parents and crossover
Mutate children according to mutation rate
Evaluate fitness of new individuals
Select individuals that survive for next generation
Repeat until
Generation limit reached
An individual achieves the target fitness
ECE457 Applied Artificial Intelligence
*
*
x
x
*
*
*
*
* *
*
*
***
x*
***
*
*
*
Population
fitness
Generation
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 42
Genetic Algorithm Example
Individuals are random, but population
converges slowly towards solution
*
R. Khoury (2007)
Page 43
8-Queen problem
Environment: state
space
Chromosome: encodes
position of queens
Fitness: number of
attacks
2 6 7 1 5 7 2 5
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 44
11
Genetic Algorithm Example
Genetic Algorithm Example
Crossover operation
Mutation operation
2
6
7
1
5 7 2
5
4
8
5
3
6 5 1
5
→
2
6
7
3
6 5 1
5
4
8
5
1
5 7 2
5
→
4
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 45
Complements (1-8,
2-7, 3-6, 4-5)
Swap two random
genes
8
5
1
5 7 2
↑
4
8
5
1
4 7 2
5
4
5
5
1
8 7 2
5
5
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 46
Limits of Genetic Algorithms
Not guaranteed to find the optimal
solution
In large complex state spaces, or with a
low mutation rate, might converge to
local optimum (premature convergence)
High mutation rate can prevent
convergence (mutation interference)
Interdependence between genes makes
it hard to find solution (epistasis)
ECE457 Applied Artificial Intelligence
R. Khoury (2007)
Page 47
12