0% found this document useful (0 votes)
31 views35 pages

ML Unit-IV Chapter-I Genetic Algorithms

Genetic algorithms provide an approach to learning based on simulated evolution. Hypotheses are described by bit strings or programs and evolve over generations using operations like crossover and mutation. Genetic algorithms search hypothesis spaces differently than methods like backpropagation and are easily parallelized.

Uploaded by

chinnupyari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views35 pages

ML Unit-IV Chapter-I Genetic Algorithms

Genetic algorithms provide an approach to learning based on simulated evolution. Hypotheses are described by bit strings or programs and evolve over generations using operations like crossover and mutation. Genetic algorithms search hypothesis spaces differently than methods like backpropagation and are easily parallelized.

Uploaded by

chinnupyari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 35

Machine Learning

R18 B.Tech. CSE (AIML) III Year – I Semester

By
Mohammed Afzal
Assistant Professor
Artificial Intelligence and Machine Learning Department
Sphoorthy Engineering College
UNIT - IV
Chapter – I: Genetic Algorithms – Motivation, Genetic algorithms, an
illustrative example, hypothesis space search, genetic programming, models
of evolution and learning, parallelizing genetic algorithms.
INTRODUCTION:

 Genetic algorithms provide an approach to learning that is based on simulated


evolution.
 Hypotheses are often described by bit strings whose interpretation depends on the
application, though hypotheses may also be described by symbolic expressions or
even computer programs.
 The search for an appropriate hypothesis begins with a population, or collection, of
initial hypotheses.
 Members of the current population give rise to the next generation population by
means of operations such as random mutation and crossover, which are patterned by
observing the biological evolution.
 At each step, the hypotheses in the current population are evaluated relative to a
given measure of fitness, with the most fit hypotheses selected probabilistically as
seeds for producing the next generation.
MOTIVATION:
 Genetic algorithms (GAs) provide a learning method motivated by an
analogy to biological evolution.
 Rather than search from general-to-specific hypotheses, or from simple-to-
complex, GAs generate successor hypotheses by repeatedly mutating and
recombining parts of the best currently known hypotheses.
 At each step, a collection of hypotheses called the current population is
updated by replacing some fraction of the population by offspring of the
most fit current hypotheses.
 The popularity of GAs is motivated by a number of factors including:
o Evolution is known to be a successful, robust method for adaptation
within biological systems.
o GAs can search spaces of hypotheses containing complex interacting
parts, where the impact of each part on overall hypothesis fitness may
be difficult to model.
o Genetic algorithms are easily parallelized and can take advantage of the
decreasing costs of powerful computer hardware.
GENETIC ALGORITHMS

 Genetic Algorithms are search algorithms inspired by Darwin’s Theory of


Evolution in nature.
o By simulating the process of natural selection, reproduction and
mutation, the genetic algorithms can produce high-quality solutions for
various problems including search and optimization.
o By the effective use of the Theory of Evolution genetic algorithms are
able to overcome problems faced by traditional algorithms.
 According to Darwin’s theory of evolution, an evolution maintains a
population of individuals that vary from each other (variation). Those who
are better adapted to their environment have a greater chance of surviving,
breeding, and passing their traits to the next generation (survival of the
fittest).
Working of Genetic Algorithms

Before getting into the working of a Genetic Algorithm let us dive into the
basic terminologies of Genetic Algorithms.

1. Chromosome/Individual
A chromosome is a collection of genes. For example, a chromosome can be
represented as a binary string where each bit is a gene.
2. Population
Since an individual is represented as a chromosome, a population is a
collection of such chromosomes.
3. Fitness Function
 In every iteration, the individuals are evaluated based on their fitness
scores which are computed by the fitness function. Individuals who
achieve a better fitness score represent better solutions and are more likely
to be chosen to crossover and passed on to the next generation.
 For example, if genetic algorithms are used for feature selection, then the
accuracy of the model with those selected features would be the fitness
function if it is a classification problem.
4. Selection
 After calculating the fitness of every individual in the population, a
selection process is used to determine which of the individuals in the
population will get to reproduce and create the offspring that will form the
next generation.
 Different types of selection methods are available:
a) Roulette wheel selection
b) Tournament selection
c) Rank-based selection
5. Crossover
 Generally, two individuals are chosen from the current generation and
their genes are interchanged between two individuals to create a new
individual representing the offspring. This process is also called mating or
crossover.
 Different types of selection methods are available:
a) One point crossover
b) Two-point crossover
c) Uniform crossover
6. Mutation
 The mutation is a random change in a chromosome to introduce
new patterns to a chromosome.
 For example, flipping a bit in a binary string.
 Different types of mutation methods are available,
a) Flip bit mutation
b) Gaussian mutation
c) Swap mutation
General workflow of a
simple genetic algorithm
Advantages of Genetic Algorithm

 The parallel capabilities of genetic algorithms are best.


 It helps in optimizing various problems such as discrete functions, multi-
objective problems, and continuous functions.
 It provides a solution for a problem that improves over time.
 A genetic algorithm does not need derivative information.
Limitations of Genetic Algorithms

 Genetic algorithms are not efficient algorithms for solving simple


problems.
 It does not guarantee the quality of the final solution to a problem.
 Repetitive calculation of fitness values may generate some
computational challenges.
Difference between Genetic Algorithms and Traditional Algorithms
o A search space is the set of all possible solutions to the problem. In the
traditional algorithm, only one set of solutions is maintained, whereas, in a
genetic algorithm, several sets of solutions in search space can be used.
o Traditional algorithms need more information in order to perform a search,
whereas genetic algorithms need only one objective function to calculate the
fitness of an individual.
o Traditional Algorithms cannot work parallelly, whereas genetic Algorithms can
work parallelly (calculating the fitness of the individualities are independent).
o It does not directly operate on candidate solutions.
o Traditional Algorithms can only generate one result in the end, whereas
Genetic Algorithms can generate multiple optimal results from different
generations.
o The traditional algorithm is not more likely to generate optimal results,
whereas Genetic algorithms do not guarantee to generate optimal global
results, but also there is a great possibility of getting the optimal result for a
problem as it uses genetic operators such as Crossover and Mutation.
o Traditional algorithms are deterministic in nature, whereas Genetic algorithms
are probabilistic and stochastic in nature.
HYPOTHESIS SPACE SEARCH
 GAs employs a randomized beam search method to seek a maximally
fit hypothesis. This search is different from that of other learning
methods.
 The hypothesis space search of GAs when compared to neural network
backpropagation; the gradient descent search in backpropagation
moves smoothly from one hypothesis to a new hypothesis. But the GA
search move more abruptly, replacing a parent hypothesis by an
offspring that may be completely different from the parent. Hence
there is a less chance that the GA search may fall into the same local
minima, which is different from gradient search methods.
 One practical difficulty in GA applications is the problem of crowding.
Crowding is a phenomenon in which some individual that is more
highly fit than others in the population quickly reproduces, so that
copies of this individuals take over a large fraction of the population.
The negative impact of crowding is that it reduces the diversity of the
population, thereby slowing further progress by the GA. Different
strategies have been explored for reducing crowding like: altering the
selection function, fitness sharing and restricting the kinds of
individuals allowed to recombine to form offspring.
GENETIC PROGRAMMING

 Genetic programming (GP) is a form of evolutionary computation


in which the individuals in the evolving population are computer
programs rather than bit strings.
 Genetic programming is an extension to genetic algorithms.
Representing Programs

 Programs manipulated by a GP are typically represented by trees


corresponding to the parse tree of the program. Each function call is
represented by a node in the tree, and the arguments to the function
are given by its descendant nodes.
 The following figure illustrates
the tree representation for the
function
 As in a genetic algorithm, the genetic programming algorithm
maintains a population of individuals (in this case, program trees).
 On each iteration, it produces a new generation of individuals using
selection, crossover, and mutation.
 The fitness of a given individual program in the population is
determined by executing the program on a set of training data.
 Crossover operations are performed by replacing a randomly chosen
subtree of one parent program by a subtree from the other parent
program.
 The following figure illustrates a typical crossover operation.
 Koza (1992) describes a set of experiments applying a GP to a number
of applications. In his experiments, 10% of the current population,
selected probabilistically according to fitness, is retained unchanged in
the next generation.
 The remainder of the new generation is created by applying crossover to
pairs of programs from the current generation, again selected
probabilistically according to their fitness.
 The mutation operator was not used in this particular set of experiments.
Remarks on Genetic Programming
 Genetic programming extends genetic algorithms to the evolution of
complete computer programs.
 Despite the huge size of the hypothesis space to search, genetic
programming has given fascinating results in a number of
applications.
 In most cases, the performance of genetic programming depends
crucially on the choice of representation and on the choice of fitness
function.
MODELS OF EVOLUTION AND LEARNING

 In many natural systems, individual organisms learn to adapt


significantly during their lifetime. At the same time, biological and
social processes allow their species to adapt over a time frame of many
generations.
 One interesting question regarding evolutionary systems is "What is the
relationship between learning during the lifetime of a single individual,
and the longer time frame species-level learning afforded by
evolution?”
 There are two approaches to answer the above questions.

Lamarckian Evolution

o Lamarck was a scientist who, in the late nineteenth century, proposed


that evolution over many generations was directly influenced by the
experiences of individual organisms during their lifetime.
o He proposed that experiences of a single organism directly affected the
genetic makeup of their offspring: If an individual learned during its
lifetime to avoid some toxic food, it could pass this trait on genetically
to its offspring, which therefore would not need to learn the trait.
o Despite the attractiveness of this theory, current scientific evidence
contradicts Lamarck's model. The currently accepted view is that
the genetic makeup of an individual is unaffected by the lifetime
experience of one's biological parents.
o Despite this apparent biological fact, recent computer studies have
shown that Lamarckian processes can sometimes improve the
effectiveness of computerized genetic algorithms.
Baldwin
Effect
The Baldwin effect, named after J. M. Baldwin (1896), who first suggested the idea.

The Baldwin effect is based on the following observations:


 If a species is evolving in a changing environment, there will be a pressure on
the individuals to support the capability to learn during their lifetime. For
example, if a new predator appears in the environment, then individuals
capable of learning to avoid the predator will be more successful than
individuals who cannot learn.
 The individuals who are able to learn many traits will be less dependent on
their genetic code for the existing traits. As a result, these individuals can
support a more diverse gene pool, relying on individual learning to overcome
the "missing" or "not quite optimized" traits in the genetic code.
 Many attempts have been made to develop a computational model to
study the Baldwin effect. Hinton and Nowlan (1987) experimented
with evolving a population of simple neural networks, in which some
network weights were fixed during the individual network "lifetime,"
while others were trainable. In their experiments they found that,
when no individual learning was allowed, the population failed to
improve its fitness over time. And when individual learning was
allowed, the population quickly improved its fitness.
PARALLELIZING GENETIC ALGORITHMS

 GAs are naturally suited to parallel implementation, and a number


of approaches to parallelization have been explored.
 Two important approaches are Coarse Grained and Fine Grained
Parallelization.
Coarse grain approaches to parallelization
 This approach of parallelization subdivide the population into distinct
groups of individuals, called demes. Each deme is assigned to a different
computational node, and a standard GA search is performed at each node.
 Communication and cross-fertilization between demes occurs on a less
frequent basis than within demes. Transfer between demes occurs by a
migration process, in which individuals from one deme are copied or
transferred to other demes.
 This process is modelled after the kind of cross-fertilization that might
occur between physically separated subpopulations of biological species.
 One benefit of such approaches is that it reduces the crowding problem
often encountered in nonparallel GAs, in which the system falls into a
local optimum due to the early appearance of a genotype that comes to
dominate the entire population.
 Examples of coarse-grained parallel GAS are described by Tanese
(1989) and by Cohoon et al. (1987).
Fine-Grained approaches to parallelization
 In contrast to coarse-grained parallel implementations of GAS, fine-
grained implementations typically assign one processor per individual
in the population. Recombination then takes place among neighboring
individuals.
 Several different types of neighborhoods have been proposed, ranging
from planar grid to torus.
 Examples of such systems are described by Spiessens and Manderick
(1991). An edited collection of papers on parallel GAs is available in
Stender (1993).

You might also like