Skip to content

Instantly share code, notes, and snippets.

@Vaguery
Created December 3, 2010 14:16
Show Gist options
  • Select an option

  • Save Vaguery/726999 to your computer and use it in GitHub Desktop.

Select an option

Save Vaguery/726999 to your computer and use it in GitHub Desktop.
Feature: Uniform mutation works as specified
In order to discover new beneficial variations of scripts that are already OK
As a symbolic regression modeler
I want uniform mutation to replace tokens in "parent" scripts with new random tokens
Scenario: uniform mutation replaces tokens with uniform random sample of available tokens
Given parent_1 is the Pile script "+ + + + + + + + + +"
And the available tokens are ["a", "b", "c", "d", "e"]
And the chance of mutation is p=1.0
When I apply mutation to that parent (independently) many times
Then the measured number of ["a", "b", "c", "d", "e"] in offspring should be statistically identical
Scenario: uniform mutation replaces randomly chosen tokens in the parent
Given parent_1 is the Pile script "+ + + + + + + + + +"
And the available tokens are ["a"]
And the chance of mutation is p=0.5
When I apply mutation to that parent (independently) many times
Then the measured number of ["a", "+"] in offspring should be statistically identical
Scenario: uniform mutation conserves token count in offspring
Given parent_1 is the Pile script "+ + + + + + + + + +"
And the chance of mutation is p=1.0
When I apply mutation to that parent (independently) many times
Then there should be 10 tokens in every offspring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment