# Using a genetic algorithm, how can I create offspring based off of two neural network structures?

0 votes
1 view

I have two arrays of objects that describe the structure of a neural network, how can I combine them to produce offspring that are realistic? The "chromosomes" would look something like this:

chromosome = [

[Node, Node, Node],

[Node, Node, Node, Node, Node],

[Node, Node, Node, Node],

[Node, Node, Node, Node, Node],

[Node, Node, Node, Node, Node, Node, Node],

[Node, Node, Node],

];

An example node:

Node {

nodesThatThisIsConnectedTo = [0, 2, 3, 5] // These numbers identify which nodes to collect output from the preceding layer from based on their index number

weights = [0.34, 0.33, 0.76, -0.56] // These are the corresponding weights applied to the mentioned nodes

}

## 1 Answer

0 votes
by (108k points)

After calculating the fitness value (i.e. accuracy) for all solutions, the remaining steps of GA in the main figure are applied the same way done previously. The best parents are selected, based on their precision, into the mating pool. Then mutation and crossover variants are applied to produce the offspring. The population of the new generation is created using both offspring and parents. These steps are repeated for a number of generations.

The best way is to implement a genetic algorithm search for each node's weight vector if you're locked on using GA.

For every node, there is a population of vectors, and each iteration one node changes its weight vector. This seems to me like a much sounder approach then cross-over between two full networks.

If you wish to know more about Neural Network visit this Neural Network Tutorial.

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer