Dawkins weasel

From RationalWiki
Revision as of 22:01, 23 April 2018 by 131.216.14.22 (talk) (→‎The weasel: Changed it to uppercase)
Jump to navigation Jump to search
We're all Homo here
Evolution
Icon evolution.svg
Relevant Hominids
A Gradual Science
Plain Monkey Business
Pyrite.jpg Fool's Gold
This article is an assay of a nugget from a cdesign proponentist's quote-mine.
Miners.jpg

In his 1986 book The Blind Watchmaker,[1] Richard Dawkins presents an algorithm which became known as the Dawkins Weasel.

The weasel

So much for single-step selection of random variation. What about cumulative selection; how much more effective should this be? Very very much more effective, perhaps more so than we at first realize, although it is almost obvious when we reflect further. We again use our computer monkey, but with a crucial difference in its program. It again begins by choosing a random sequence of 28 letters, just as before:

WDLTMNLT DTJBKWIRZREZLMQCO P

It now 'breeds from' this random phrase. It duplicates it repeatedly, but with a certain chance of random error - 'mutation' - in the copying. The computer examines the mutant nonsense phrases, the 'progeny' of the original phrase, and chooses the one which, however slightly, most resembles the target phrase, METHINKS IT IS LIKE A WEASEL. In this instance the winning phrase of the next 'generation' happened to be:

WDLTMNLT DTJBSWIRZREZLMQCO P

Not an obvious improvement! But the procedure is repeated, again mutant 'progeny' are 'bred from' the phrase, and a new 'winner' is chosen. This goes on, generation after generation. After 10 generations, the phrase chosen for 'breeding' was:

MDLDMNLS ITPSWHRZREZ MECS P

After 20 generations it was:

MELDINLS IT ISWPRKE Z WECSEL

By now, the eye of faith fancies that it can see a resemblance to the target phrase. By 30 generations there can be no doubt:

METHINGS IT ISWLIKE B WECSEL

Generation 40 takes us to within one letter of the target:

METHINKS IT IS LIKE I WEASEL

And the target was finally reached in generation 43. A second run of the computer began with the phrase:

Y YVMQKZPFfXWVHGLAWFVCHQXYOPY,

passed through (again reporting only every tenth generation):

Y YVMQKSPFTXWSHLIKEFV HQYSPY

YETHINKSPITXISHLIKEFA WQYSEY

METHINKS IT ISSLIKE A WEFSEY

METHINKS IT ISBLIKE A WEASES

METHINKS IT ISJLIKE A WEASEO

METHINKS IT IS LIKE A WEASEP

and reached the target phrase in generation 64. In a third run the computer started with:

GEWRGZRPBCTPGQMCKHFDBGW ZCCF

and reached METHINKS IT IS LIKE A WEASEL in 41 generations of selective 'breeding'.

In action

Thanks to the marvels of the modern Internet, you can see the weasel for yourself.[2] Click the start button to see the phrase "evolve" before your very eyes!

METHINKS IT IS LIKE A WEASEL

By repeating the process you can begin to get a picture of how evolution can work. Sometimes it happens fast, sometimes slowly. Sometimes it gets word pretty quick while the rest of the phrase lingers around looking like gibberish. Other times it gets stuck in gibberish land until one tiny kick lets it evolve quickly. Of course, evolution isn't always directional like this, the Weasel program certainly has an aim; to reproduce the exact phrase put into it from randomness and variation. However, natural selection does favour certain aspects or abilities or traits over others and the Weasel program certainly does simulate this. In the case of the algorithm, it generates an "environment" that favours strings of words that look like ME THINKS IT IS LIKE A WEASEL, just like a green environment would favour green insects as they would camouflage themselves against predators. Thus, when the algorithm runs, it uses random mutation, followed by natural selection, to derive something that is optimal for the environment it's in.

Implementation

The Dawkins weasel checks out the surroundings before moving in for the kill.

The algorithm has been implemented in various programming languages by numerous programmers. Most implementations are quite similar, along the following lines:

  1. choose random string
  2. copy string n times with mutation
  3. take best fitting string
  4. Stop, if the number of correct letters is 28, otherwise
  5. goto 2

Step 3 includes the evaluation of a fitness function. Virtually all implementations define the best fitting string as the one with the most correct letters - a number between 0 and 28.

William Dembski, being a noted intelligent design advocate, chooses another way:

  1. choose random string
  2. if all letters are in place: STOP Otherwise:
  3. mutate letters which are not in place
  4. goto 2

Surprisingly, Dembski insists that this is the implementation Richard Dawkins used in his book - though Dawkins himself says otherwise. Answers in Genesis makes the same claim.[3] The intellectual dishonesty in both cases is obvious as there exist examples of freely available scripts implementing the algorithm which clearly do allow for the mutation of in-place characters.[4]

This confusion is doubtless because the fitness function used combined with a small percentage chance of mutations does not encourage regressions in small strings. Using a longer sentence and increasing the mutation chance as high as 10% tends to give regressions in many generations, even to the point where the fittest in the generation is not as fit as its progenitor. High mutation rates take longer to converge on the wanted solution, which may seem at first somewhat counter intuitive.

See also

External links

References

  1. Richard Dawkins: The Blind Watchmaker, 1986, pp. 46-47
  2. If you want the Dawkins weasel in other computer languages, see the "like a weasel" blog, which has versions in Python, Perl, Excel VBA, etc.
  3. http://www.answersingenesis.org/articles/tj/v12/n3/dawkins
  4. http://www.cbs.dtu.dk/courses/27615.mol/weasel/weasel.py