accord-net / framework

Machine learning, computer vision, statistics and general scientific computing for .NET
http://accord-framework.net
GNU Lesser General Public License v2.1
4.48k stars 2k forks source link

Genetic library useless #362

Open kyjak opened 7 years ago

kyjak commented 7 years ago

I have to find a root cause, but as of now, it seems the genetic library does not yield good results. I was suspicious, and crafted my own lib [using the same evaluation,mutation etc. functions] and the results are 100x better. Anybody experiencing similar issues?

cesarsouza commented 7 years ago

Hi Kyjak,

Please, do you think you could share a code snippet showing that the current genetic library is not working for you?

The genetic library was originally part of another project called AForge.NET, and has received only very few modifications since then. The original project didn't include many unit tests, so its possible some bugs could either have been introduced in those modifications, or were already present but had not yet been detected.

Many thanks in advance.

Regards, Cesar

kyjak commented 7 years ago

The code is rather complex, but to describe it, chromosome is a int array of coordinates. the idea is - the methods (crossover,mutate,generate) - outside of the GA engine, are the very same. So if there was a mistake in them,it would affect both Aforge and mine imlementations. It got weird when the Aforge could not simply crawl the state space to come closer to a solution - tried elite/roulette selection. So the possible bottleneck is in the Aforge's Selection/RunEpoch code, but no idea how to pinpoint it,as there are no exceptions or strange values coming up. Just the search ability is terrible.

zgrkpnr commented 5 years ago

@kyjak Can you at least tell us your configuration? Which chromosome type do you use? Which random generators do you use when you create that chromosome? What are their parameters? For instance,

var generator = new NormalDistribution(0, 0.01);
var doubleArrayChromosome = new DoubleArrayChromosome(generator, generator, generator, neuronCount);

this code hardly yields any result for the evolution of my ActivationNetwork. However, if I define 3 different generators and adjust their parameters (trial&error) I get better solutions than Backpropagation.