Search code examples
neural-networkgenetic-algorithmnormal-distributionmutationuniform-distribution

Mutate weights and biases in a neural network through genetic algorithm


I have a genetic algorithm evolving a population of neural networks

Until now I make mutation on weights or biases using random.randn (Python) which is a random value from a normal distribution with mean = 0

It works "well" and I managed to achieve my project using it be wouldn't it be better to use a uniform distribution on a given interval ?

My intuition is that it would lead to more variety in my networks


Solution

  • I think, that this question has no simple solution. In case of normal distribution will be numbers around mean have more chances to be "selected" by your number generator, uniform distribution give almost equal chance to all numbers. That is clear but answer to question, will equal chance mean better result, lays according to me only at empirical experiments. So I suggest you to perform experiments with normal and uniform distribution a try to judge based on results.

    About variety. I assume that you create some random vector which represents weights. At stage of mutation you perform addition of random number. This number will be more likely from close interval around mean, so in case 0 mutation with high probability will be change of some elements only little. So there will be only little improvements over vector and sometimes something big shows up. In case of uniform distribution will be changes more random, which leads to different individual. Question is, will be these individual better? I don't know, but I offer you another view. I look to genetic algorithms like an analogy to evolution theory. And from this point of view, cumulative little improvements of individual with little probability of some big change is more appropriate. Think about situation, used is uniform distribution, but children has low fitness due to big changes so at phase of creating new generation will be not selected. And you will wait so long for one tiny improvement which make your network works with good results.

    Maybe one more thing. Your experiments maybe show that uniform/normal distribution is better. But such result may be true only for your current problem, no at general.