ML Unit 4 Notes
ML Unit 4 Notes
ML Unit 4 Notes
Introduction :
Genetic algorithm is a search based optimization technique based on the
principles of genetics and natural selection. GA was developed by Mr. John
Holland. GA are a subset of evolutionary computation. In GA, we have a
population of possible solutions of a given problem. Our job is to choose the
fittest solution from it. These solution then undergo recombination and mutation
producing new children. This process is repeated over various generations. In this
way, we keep evolving better solutions over next generations, till we reach a
stopping criteria.
Genetic Operators :
A genetic operator is an operator used in genetic algorithms to guide the
algorithm towards a solution for a given problem. There are three main types
of operators mutation, crossover and selection.
Start
Selection
Crossover
Mutation
Terminate
? No
Yes
Best individual solution
Stop
1 1 0 1 0 1 0 0 0
Parents
0 1 0 0 1 0 1 1 1
1 1 0 1 1 0 1 1 1
Children(offspring)
0 1 0 0 0 1 0 0 0
ii. 2 – point and K-point crossover: In two-point crossover, two points are
selected randomly from the parent chromosomes. The bits in between the two
points are swapped between the parent chromosome.
1 1 1 1 1 1 1 1
parents
0 0 0 0 0 0 0 0
1 1 0 0 0 0 1 1
Children
0 0 1 1 1 1 0 0
1 0 0 0 1 1 0 1
children
0 1 1 1 0 0 1 0
1 2 3 4 5 6 7
1 2 3 4 8 6 7
1 2 3 4 5 6 7 8
1 6 9 4 5 2 7 8
1 2 5 3 4 6 7
5) Inversion mutation: In this method, a subset of genes is chosen and their
values are inverted as a string.
1 2 3 4 5 6 7 8
1 2 5 4 3 6 7 8
Genetic Programming
In genetic programming, Programs or problems are expressed as tree rather
than as lines of code. For example, the simple expression
max(x ∗ x, x + 3 ∗ y)
In genetic algorithm it can be expressed as following figure,
The five major preparatory steps for the basic version of genetic
programming require the human user to specify:
step1: the set of terminals (e.g., the independent variables of the problem,
zero-argument functions, and random constants) for each branch
of the to-be-evolved program.
step2: the set of primitive functions for each branch of the to-be-evolved
program.
step3: Measure fitness (for explicitly or implicitly measuring the fitness
of individuals in the population).
step4: certain parameters for controlling the run.
step5: the termination criterion and method for designating the result of
the run.
Image processing in deep learning: The genetic algorithm are used for
various digital image processing tasks like dense pixel matching.
Engineering design: The genetic algorithm are used in computer
modelling and simulation to make design cycle fast and economical.
Robot trajectory generation: Gas are used to decide the path of robotic
arm to move from one place to other place.
DNA analysis: Gas are used for determining the DNA structure using
spectrometer data and evolving better solutions.
Questions:
1. Write down the steps of genetic algorithm.
2. Discuss different types of crossover and mutation operator.
3. Advantage, disadvantage and application of genetic algorithm.
4. Explain genetic programming with example..