Live data from Hacker News

A Story to Explain Genetic Algorithms

jake.simvla.com

21–30 of 35 posts

Re: A Story to Explain Genetic Algorithms

#22

Neat little story, despite the grammar and capitalization. Is it common to use _ as an index variable? Edit: for _ in range(4):

Most of the code is a little verbose for Python. For example make() function could simply be:

    return [random.randint(1,10000) for x in range(4)]
Also remember that a little kitten dies every time you write a for loop as follows:

    for index in range(len(some_list)):

Re: A Story to Explain Genetic Algorithms

#24
post #22

Neat little story, despite the grammar and capitalization. Is it common to use _ as an index variable? Edit: for _ in range(4):

Most of the code is a little verbose for Python. For example make() function could simply be: return [random.randint(1,10000) for x in range(4)] Also remember that a little kitten dies every time you write a for loop as follows: for index in range(len(some_list)):

I'm a python noob. Why does a kitten die? You're creating a new list of the same size of the source list (once) and iterating over it. How can you achieve the same w/out creating a new list?

Re: A Story to Explain Genetic Algorithms

#26

Once upon there was another local search algorithm. It was called GA. The end.

Actually, GAs are mostly described as global search algorithms, because they use populations with recombination and therefore simultaneously consider potentially disparate areas of the search space.

Re: A Story to Explain Genetic Algorithms

#27
post #8

If you're interested in the world of "computational intelligence" aka "nature-inspired computation", this book is a good high level survey: http://www.cleveralgorithms.com/ (You can also find stuff under the heading of "metaheuristics" -- http://cs.gmu.edu/~sean/book/metaheuristics/ ). GAs are one of four (!) different independently developed strands of thought -- Genetic Algorithms, Genetic Programming, Evolutionary…

Those are some good links, thanks. Are there clear distinctions between these four areas? It seems like the separation is a historical artifact, when they're all basically doing the same thing.

To a large degree you are correct, the different algorithms are often interchangeable. Sometimes this is not the case: e.g. Genetic Programming is used to search for algorithms that are not easily represented and searched for with other evolutionary algorithms.

Re: A Story to Explain Genetic Algorithms

#28

It's not at all clear from the story why or if having multiple recipes "mate" works better than just using one recipe and fiddling with it.

That's a very insightful comment. The debate over whether recombination gives you anything "extra" continues in academia to this day. For example, papers on the controversy surrounding crossover in Genetic Programming (Luke and Spector in the 90s is a good starting point).

Re: A Story to Explain Genetic Algorithms

#29

Neat little story, despite the grammar and capitalization. Is it common to use _ as an index variable? Edit: for _ in range(4):

I've seen it before, but it's a little jarring. Not sure what's wrong with just using i.

To avoid unused variable warnings.

Re: A Story to Explain Genetic Algorithms

#30

It's not at all clear from the story why or if having multiple recipes "mate" works better than just using one recipe and fiddling with it.

It doesn't. At least there is zero evidence that it does and there is a lot of evidence that it does not (i.e. simple hill climbing beats GA in every practical situation). I've mentioned this before on HN and reddit, but from time to time these kind of stories come up again. There is a weird fascination with genetic algorithms. Even though dozens of people have a career based on it, as far as I can tell the whole field of biologically inspired optimization algorithms is basically pseudoscience. Note optimization algorithms, so this does certainly not include e.g. neural networks, which work fantastically well.
Post reply on HN