-2

I want to use neural network to learning cars riding on the racetrack. Imo best way to learning net is using genetic algorithm, but in each tutorial the genotype is encode by 0 and 1 (binary values). In my net weights are double values, so genotype looks like 3,12; 9,12; 0,83, -0,73 etc.

So my question is:

Should I encode each weight to binary value ? I think I can use double values but I don't know how can I mutate this ? Binary value I can inverse from 0 to 1 and from 1 to 0 but double ?

Bambelal
  • 179
  • 1
  • 2
  • 13
  • 1
    Please read how to create a [mcve] and add the missing information to your Post by editing it :) If you haven't read [ask] yet i recommend to do so :) I highly recommend to follow the 2 guides i linked as the people on SO are more likely to answer questions when the posts follow these guides. What i'm missing in particular is - What have u tried so far? What errors/problems do you face? Do you may have codesnippets that show what you tried so far? – Tobias Theel Jan 20 '18 at 10:36
  • I only need to know - Do I have to encode double weights value to binary values or I can normal use double values as genotype. I know how to implement this in code. – Bambelal Jan 20 '18 at 10:44
  • 1
    Are you sure that you want to use a genetic algorithm to get weights in your network? Those algorithms sometimes are used for learning layer structure of a network but for weights you better use back propagation. – algrid Jan 20 '18 at 12:26

1 Answers1

0

From a theoretical point of view yes, you can. The condition anyhow is you correctly define all the operations (like crossover, mutation, etc.) for continuous values too.

The answer then is yes, if your software implementation enables you to do so.

Let me draw a simplified example.

If the algorithm aims at identifying the best fit for the sine function, and you can use shapes [triangle, square, half-circle], y magnitude and x displacement, you can have a chromosome of let's say N shapes to be summed together.

In such a case x and y must be both double: you can mutate them e.g. by adding a random number in a sensate range, and perform crossover by exchanging x or y with the partner, or even collecting a full tuple (shape-x-y).

I would say that the mantra is to keep things coherent, and let individuals mutate in a sensate way for your model (a bad choice would be cross x with y).

Fabio Veronese
  • 7,726
  • 2
  • 18
  • 27