Class 20 21 Unlocked
Class 20 21 Unlocked
• If very little background knowledge is available and the problem environment provides
a natural measure for the quality of outcomes, it is appropriate to view the problem of
learning as a search for high-performance structures ... [Grefenstette]
• Genetic algorithms search by allocating effort to regions of the search space based on an
estimate of the relative performance of competing regions. [In complex domains] one
expects perpetual novelty to be a characteristic feature ... In these cases, traditional
search techniques ... are likely to be misled [and] genetic algorithms may be the search
technique of choice for machine learning systems ... [Fitzpatrick and Grefenstette]
GA Terminology
Outline of the Basic Genetic Algorithm
• [Start] Generate random population of n chromosomes (suitable solutions for the
problem)
• [Fitness] Evaluate the fitness f(x) of each chromosome x in the population
• [New population] Create a new population by repeating following steps until the
new population is complete
– [Selection] Select two parent chromosomes from a population according to
their fitness (the better fitness, the bigger chance to be selected)
– [Crossover] With a crossover probability cross over the parents to form a new
offspring (children). If no crossover was performed, offspring is an exact copy
of parents.
– [Mutation] With a mutation probability mutate new offspring at each locus
(position in chromosome).
– [Accepting] Place new offspring in a new population
• [Replace] Use new generated population for a further run of algorithm
• [Test] If the end condition is satisfied, stop, and return the best solution in current
population
• [Loop] Go to step 2
Basic Genetic Algorithm
• Start with a large “population” of randomly generated
“attempted solutions” to a problem
• Repeatedly do the following:
– Evaluate each of the attempted solutions
– Keep a subset of these solutions (the “best” ones)
– Use these solutions to generate a new population
• Quit when you have a satisfactory solution (or you
run out of time)
GA Operators
• Methods of representation.
• Methods of selection.
• Methods of Reproduction.
GA Operators
• Methods of representation.
• Methods of selection.
• Methods of Reproduction.
Coding
• Encode solutions as binary strings: sequences of 1's
and 0's, where the digit at each position represents the
value of some aspect of the solution.
(A)
(B)
(C)
HOW IT WORKS ?
Roulette wheel selection (Fitness-Proportionate
selection)
• Conceptually, this can be represented as a game of roulette -
each individual gets a slice of the wheel, but more fit ones get
larger slices than less fit ones.
The selection is done such a way that the best model in the population contributes a number
of copies that is an integral (the number is predetermined) number of copies that the worst
model receives.
3.Tournament Selection
• Random pairs are selected from a population of,
say n, individuals and their fitness values are
computed.
• The fitness is compared and one of the two
models is accepted based on a probability “Ps”,
called the tournament selection number which is
an adjustable parameter.
11001011+11011111 = 11001111
Two point crossover - two crossover point are selected, binary string from beginning of
chromosome to the first crossover point is copied from one parent, the part from the first to the
second crossover point is copied from the second parent and the rest is copied from the first
parent
Mutation
The last genetic operator is mutation. It is the random alteration of a bit. It can
be carried out during the crossover process.[see the example in next slide]
– Experiment:
• Pigeon in Skinner box
• Present paintings of two different artists (e.g. Chagall /
Van Gogh)
• Pigeons were able to discriminate between two
pictures with 95% accuracy (when presented with
pictures they had been trained on)
Neural networks are non-linear statistical data modeling tools. They can
be used to model complex relationships between inputs and outputs or to
find patterns in data.
What are Neural Networks?
• Models of the brain and nervous system
• Highly parallel
– Process information much more like the brain than a
serial computer
• Learning
• Applications
– As powerful problem solvers
– As biological models
• Neurone vs. Node
Node
• The sigmoid function, also called the
sigmoidal curve (von Seggern 2007, p. 148) or
logistic function, is the function
1
y= −x
1+ e
Artificial Neuron
w1j
x1
w2j n
x2 s j = ∑ wij xi y j = f (s j )
i =0
yj
1
−s
wnj 1+ e j
xn
bj
Artificial Neuron
w1j
x1
w2j n
x2 s j = ∑ wij xi y j = f (s j )
i =0
yj
1
−s
wnj 1+ e j
xn
bj
ANNs – The basics
An artificial network consists of a pool of simple processing units which
communicate by sending signals to each other over a large number of weighted
connections.
1. Neurones (nodes)
2. Synapses (weights)
In traditional feed-forward neural networks, a hidden
layer neuron is a neuron whose output is connected to
the inputs of other neurons and is therefore not visible
as a network output (hence the term hidden layer).
• Feeding data through the net:
Squashing:
1
= 0.3775
1+ e 0.5
ANNs – The basics
1. Learning stage
Your knowledge
is useless !!
2. Test stage
(working stage)
Neural Networks
The two most important steps in applying neural networks to recognition problems are the
selection and learning stages, since these directly influence the overall performance and thus
the results obtained.
Three reasons can cause a bad performance (Romeo, 1994): an inadequate network
configuration, the training algorithm being trapped in a local minimum, or an unsuitable
learning set.
Weights are optimized using the training set. However, cross validation with the second set
ensures an overall good performance.
Classification (Learning)
RL works with data from a dynamic environment. And the goal is not to cluster data
or label data, but to find the best sequence of actions that will generate
the optimal outcome.
The way reinforcement learning solves this problem is by allowing a piece of software
called an agent to explore, interact with, and learn from the environment.
• Game Playing
• Robot Navigation
Reinforcement Learning
One of the challenges that arise in reinforcement learning, and not in other kinds of
learning, is the trade-of between exploration and exploitation. To obtain a lot of
reward, a reinforcement learning agent must prefer actions that it has tried in the past
and found to be effective in producing reward. But to discover such actions, it has to
try actions that it has not selected before. The agent has to exploit what it already
knows in order to obtain reward, but it also has to explore in order to make better
action selections in the future. The dilemma is that neither exploration nor exploitation
can be pursued exclusively without failing at the task. The agent must try a variety of
actions and progressively favor those that appear to be best.
• Game Playing
• Robot Navigation