Hi I want to ask about weight selection in neural network using genetic algorithm.

Right now what I understand is

  1. Initialize population
  2. Encode the weight of the neural network to the chromosome
  3. Calculating the error and fitness
  4. crossover and mutation
  5. looping until satisfy the condition

Is it the right thing?

if yes what I'm still not sure are :

  1. If I have 50 chromosome in one population that means I must create 50 neural network?
  2. Let's say I have 100 different input and I want the network to learn it by using weight selection only (not using backpropagation) and how I calculate the error? Testing and calculating the error of every input(using MSE) and divide it by 100?

I think that's all for now

Thank you


1 Answer 1


Your understanding is correct.

  1. Yes, you do create a new neural network for each chromosome (although you're considering the network structure as fixed, so technically you could reuse them by just resetting the weights anew for each chromosome.

  2. For the error, you're on the right track. For a GA, generally only relative differences in fitness are important, so it doesn't really matter if you divide by 100 or not -- that's just linearly scaling the fitness values. That might matter for some choices of genetic operators (e.g., roulette-wheel selection can be sensitive to absolute fitness values), but often it won't matter at all.

  • $\begingroup$ Thank you for the answer, but now I already used roulette-wheel selection, and right now I calculate my fitness with this function (1-error(with MSE)) * 100 will it affected how accurate is the result and how long it'll take to achieve convergence? thank you $\endgroup$ Commented Jan 4, 2013 at 12:36
  • $\begingroup$ As a rule of thumb, I'd avoid roulette wheel selection anyway, as it doesn't allow for control of selection pressure very well. By default, I'd assume binary tournament selection to start with and work from there. Adding a constant to each fitness value will change selection probabilities under roulette wheel, but multiplying by a constant doesn't, as can be shown directly by comparing the selection probabilities directly. f_i / \sum_{j=1}^n f_j for the unscaled version versus 100*f_i / \sum_{j=1}^n 100*f_j with your scaling. As the 100 factors out of each term, the two are equivalent. $\endgroup$
    – deong
    Commented Jan 4, 2013 at 14:40
  • $\begingroup$ thank you for your answer! I'll try to use binary tournament selection as you said above :) $\endgroup$ Commented Jan 4, 2013 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.