Using genetic algorithms for neural networks

I am currently working on a project that will use genetic algorithms to optimize neural networks. I understand that this is probably not the best way to optimize them, but I'm new to both, so I just wanted to try using them.

My plans are as follows (subject to change, many). My input neurons will use a dataset that can have almost any positive number (including decimal numbers up to two places, so they really will be floating point numbers), but most likely from 0 to 20,000. Since it is important how the numbers are compared with each other by value, and not how large they are, they are first divided by the largest number of all values ​​that will be entered. They will be multiplied by the scales (any positive or negative float) before moving on to their hidden layer. Each neuron in the hidden layer will summarize all of its inputs until they are calculated. Then they will go through the logistic function and will be withdrawn.

My environment is Visual Studio C ++ 2010 Express, and I use clr.

My problem is the genetic algorithm and how it will work. This will be a weight adjustment. My problem is that when he randomly changes the bit in one of the scales (mutation speed), he can make the scales unusually high or low, which leads to overflow or some other error when multiplying by input and adding with others. I have no idea how I would organize my chromosomes. So, would it be better to randomize according to the weight of the selection, rather than random bits, and change them to a random number within a certain range? I am mainly looking for suggestions on how to organize this without causing errors when the values ​​get too large or too small while maintaining performance.

Thank you, (and sorry if this should be in theoretical computer science, but I thought it would not fit there)

+8
c ++ clr neural-network genetic-algorithm
source share
2 answers

(Artificial) neural networks (ANNs) are usually difficult to optimize, and genetic algorithms (GAs) are a pretty good approach to this (mainly because everything else tends to be very limited in how well it can work). Of course, there are alternatives that work well, but they are more difficult and sophisticated to program and configure correctly (back propagation with simulated annealing and a pulse of learning). And I understand that you are doing this project mainly to play with these things.

Perhaps you should take a look at Evolutionary Neurocontrollers (ENC), this is a field where genetic (or evolutionary) algorithms are used to train ANNs for complex navigation tasks (for example, interplanetary space missions are one of the applications that I personally conducted research).

For the ANN part, I would suggest that you do not limit yourself to logistic functions (I know that the sigmoid is inspired by biological neurons, but this does not mean that they are always better). In addition, there are many other functions, logistic functions are used in part because they make back propagation much faster and easier. But Radial-Basis functions also work wonders (IMO and from what I saw, most successful ANN applications use Radial-Basis functions, i.e. RBF-NN). Usually people use either Gaussian functions, hyperspherical functions, and very often triangular functions (called Fuzzy Networks, another huge class of ANNs).

As for GA, I would not recommend this type of mutation that you describe (i.e., flip bits) for the reasons you mentioned. People do not use this mutation when working with genes with real meaning. One very simple mutational method is simply to decide (with some probability) to mutate an individual person, and then select one of his gene to be mutated, and then simply generate a new element of the gene to replace it with a random number generator (rand ( )), At the same time, you can limit the scale of the generated elements of the gene to avoid the problems of turning your individual degenerate (that is, one completely incorrect element of the gene can make the whole person useless). What are genes? Well, for ANN, it's usually a large vector containing all the weights of all the neurons in your network. You can guess that people rarely use GA if the number of neurons is too large. I also recommend that you use tournament selection to select individuals to play. As for the crossover (i.e., Mixing two parents with the goal of creating a child), simply follow the weight order and choose the weight from one of the parents for each element of the child in a random order with equal probability.

I personally did what I described above, and it works very well for certain problems (reduced size and high complexity, that is, there is no obvious optimal solution).

Finally, do not expect this to work so easily. As a rule, this will require a population size and several generations, which is much higher than you expect (after all, evolution is a very slow process!). So, do not try the population of 10 people and run for 50 generations, and, unfortunately, say: "Oh, I think it will not work ...". Try more in the number of thousands of people in the population and from several thousand to one hundred thousand generations, depending on the scale of the problem that you are addressing, of course.

+6
source share

Your problem is chromosome representation. He is known as the Hamming Cliff Problem . You can use the Gray Code to represent chromosomes that have no problem with the Hamming problem

+3
source share

All Articles