# Artificial Neural Network Genetic Algorithm

## Genetic Algorithm

Genetic Algorithm

- A Genetic Algorithm method inspired in the world of Biology, particularly, the Evolution Theory by Charles Darwin, is taken as the basis of its working.
- John Holland introduced the
**Genetic Algorithm**in 1975. Genetic Algorithms are utilized to optimization problems by copying the evolutionary behavior of species. From an initial random population of solutions, this population is advanced through selection, mutation, and crossover operators, inspired in natural evolution. - By implementing the given set of operations, the population goes through an iterative procedure in which it reaches various states, and each one is called generation.
- As a result of this procedure, the population is expected to reach a generation in which it contains a decent solution to the problem. In the Genetic Algorithm, the solution of the problem is coded as a string of bits or real numbers.
- Genetic algorithms (GAs) are algorithms that are used for
**optimization**and machine learning based on various features of biological evolution.

## Components

Genetic Algorithm Components

- A process of coding solutions is to solve the problem of chromosomes.
- An evaluation function is that recovers a rating for each chromosome given to it.
- Operators that are implemented to parents when they reproduce to alter their genetic composition. The standard operators are mutation and crossover.
- Operators that may be implemented to parents when they reproduce to modify their genetic composition. The standard operators are
**mutation and crossover.**

## Development of ANNs with Evolutionary Computation

- The advancement of ANNs is a subject that has been broadly deal with extremely different techniques. The world of evolutionary algorithms is no exemption, and evidence of that is the incredible amount of works that have been published about the various techniques in this area, even with genetic algorithms or GP.
- As a general rule, the field of ANNs generation using evolutionary algorithms is separated into three principal fields:
**Evolution of weight, Architectures, Learning rules.**

Genetic Algorithm Fields

**Initially,**the weight evolution begins from an ANN with a previously determined topology. The issue to be solved is the training of the association weights, attempting to limit the network error.**Second,**the evolution of architecture incorporates the generation of the topological structure. In order to utilize evolutionary algorithms to create ANN architectures, it is required to select how to encrypt the genotype of a given network for it to be used by the genetic operators.- At the first option, direct encoding, there is a balanced analogy between all of the genes and their resulting phenotypes.
- The most typical encoding technique comprises a matrix that represents an architecture where each component reveals the presence or absence of association between two nodes.
- In the encoding schemes, GP has been utilized to create both architecture and association weights at the same time, either for feed-forward or recurrent ANNs, with no limitations in their architecture.
- Apart from direct encoding, there are some indirect encoding techniques. In these techniques, just a few characteristics of the architecture are encoded in the chromosome. These techniques have various types of representation. First, the parametric representations portray the network as a group of parameters. For example, numbers of nodes for each layer, the number of associations between two layers, the number of hidden layers, etc.
- Another no direct representation type depends on grammatical rules. In this system, the network is represented by a group of regulations, build as production rules that make a matrix that represents the network.
- With respect to the evolution of the learning rule, there are various approaches, however, most of them are just based on how learning can alter or manage the evolution and also on the relationship between the architecture and the association weights.

## ANNs working principle:

- The working principle of a standard Genetic Algorithm is illustrated in the given figure. The significant steps involved are the generation of a population of the solution, identifying the objective function and fitness function, and the application of genetic operators.

## Start

- It generates a random population of n chromosomes.

## Fitness

- It calculates the fitness f(x) of each chromosome x in the population.

## New Population

- It generates a new population by repeating the following steps until the New population is finished.

Steps in Genetic Algorithm

## Selection

- It chooses two parent chromosomes from a population as per their fitness. The better fitness, the higher the probability of getting selected.

## Crossover

- In crossover probability, cross over the parents to form new offspring (children). If no crossover was performed, the offspring is the exact copy of the parents.

## Mutation

- In mutation probability, mutate new offspring at each locus.

## Accepting

- It places new offspring in the new population.

## Replace

- It uses the newly generated population for a further run of the algorithm.

## Test

- If the end condition is satisfied, then it stops and returns the best solution in the current population.

## Loop

- In this step, you need to go to the second step for fitness evaluation.
- The basic principle behind the genetic algorithms is that they generate and maintain a population of individuals represented by chromosomes.
**Chromosomes**are a character string practically equivalent to the chromosomes appearing in DNA. - It undergoes a process of evolution as per rules of selection, reproduction, and mutation. Each individual in the environment gets a measure of its fitness in the environment. Reproduction chooses individuals with high fitness values in the population.
- Through crossover and mutation of such individuals, a new population is determined in which individuals might be an even better fit for their environment. The process of crossover includes two chromosomes swapping chunks of data and is analogous to the process of reproduction. Mutation introduces slight changes into a little extant of the population, and it is representative of an evolutionary step.

## Difference Between Traditional and Genetic Approach

- An algorithm is a progression of steps for solving a problem. A genetic algorithm is a problem-solving technique that uses genetics as its model of problem-solving.
- It is a search method to find approximate solutions to optimization and search issues. One can easily distinguish between a traditional and a genetic algorithm.

Traditional Algorithm | Genetic Algorithm |
---|---|

It selects the next point in the series by a deterministic computation. | It selects the next population by computation, which utilizes random number generators. |

It creates an individual point at each iteration. . | It creates a population of points at every iteration. |

Advancement in each iteration is problem specific. | Concurrence in each iteration is a problem independent. |

## Advantages of Genetic Algorithm

- The genetic algorithm concept is easy to understand.
- The genetic algorithm supports
**multi-objective**optimization. - A genetic algorithm is suitable for noisy environments.
- The genetic algorithm is robust with respect to local minima/maxima.
- The genetic algorithm utilizes probabilistic transition rules.
- The genetic algorithm utilizes payoff (objective function) information, not derivatives.
- The genetic algorithm works well on mixed discrete functions.

## Limitations of Genetic Algorithm

- Although Genetic algorithms have demonstrated to be a quick and powerful problem-solving approach, some limitations are found embedded in it.
- The first, and most significant, consideration in making a genetic algorithm is characterizing representation of the problem.
- The language used to determine candidate solutions must be robust. It must be able to endure random changes such that fatal errors don't mistake.
- One significant obstacle of genetic algorithms is the coding of the fitness (evaluation) function so that a higher fitness can be achieved, and better solutions for the problem are produced.
- A wrong decision of the fitness function may lead to significant consequences.
- Along with making a decent choice of the fitness function, different parameters of a Genetic Algorithm like population size, mutation, and crossover rate must be chosen effectively.
- Small population size will not give enough solution to the genetic algorithm to produce precise results. A frequency of genetic change or poor selection scheme will result in disrupting the beneficial schema.
- Though
**Genetic algorithms**can find exact solutions to these sorts of problems, traditional analytic techniques can find the same solutions in a short time with few computational data.

## Applications of Genetic Algorithm:

## Genetic Algorithm in Robotics

**Robotics**is one of the most discussed fields in the computer industry today. It is used in various industries in order to increase profitability efficiency and accuracy.- This is the place where the Genetic Algorithm places a vital role. Hence a suitable method is required, which will lead the robot to its objective and will make it adaptive to new situations as it encounters them.

## Genetic Algorithm in Financial Planning

- Models for tactical asset distribution and international equity methodologies have been enhanced with the use of Gas. Genetic algorithms are extremely efficient for
**financial modeling applications**as they are driven by adjustments that can be used to improve the efficiency of predictions and return over the benchmark set. In addition, these methods are robust, permitting a greater range of extensions and constraints, which may not be accommodated in traditional techniques.

If you want to learn about Artificial Intelligence Course , you can refer the following links Artificial Intelligence Training in Chennai , Machine Learning Training in Chennai , Python Training in Chennai , Data Science Training in Chennai.