Lexicase selection is a parent selection mechanism invented by @lspector and studied extensively by him and @thelmuth (and others such as @mcphee) in various papers and in @thelmuth’s dissertation. Lexicase selection is a behavior-based selection approach that does not aggregate error values on test cases into a single fitness value. Instead, it considers test cases individually, placing more emphasis on some cases than others.
Here is some pseudocode for the lexicase algorithm:
- Initialize
a. Set candidates to be the entire population of programs.
b. Set cases to be a list of all of the test cases in the training set in random order. - Loop
a. Set candidates to be the subset of the current candidates that have exactly the best performance of any individual currently in candidates for the first case in cases.
b. If candidates contains just a single individual then return it.
c. If cases contains just a single test case then return a randomly selected individual from candidates.
d. Otherwise remove the first case from cases and go to Loop.
The lexicase selection algorithm first randomly orders the test cases from the training set. It then eliminates any individuals in the population that do not have the best performance on the first test case. Assuming that more than one individual remains, it then loops, eliminating any individuals that do not have the best performance of the remaining individuals on the second test case. This process continues until only one individual remains and is selected, or until all test cases have been used, in which case it randomly selects one of the remaining individuals.
Lexicase selection sometimes selects individuals that perform well on a relatively small number of test cases, even if they perform very poorly on other cases. This differs from most other selection algorithms, which select individuals based on aggregations of performance on all test cases into a single scalar fitness value. As such, lexicase often selects specialist individuals that solve parts of the problem extremely well, as opposed to tournament selection and implicit fitness sharing (IFS), which select generalist individuals that have good performance on average across the test cases. Although these individuals may have worse summed error across all test cases, the hope is they will be able to reproduce in ways that pass on their preeminence on certain cases while improving with respect to others. In order to give every test case equal selection pressure, each lexicase selection event uses a randomly shuffled list of test cases to determine which test cases are treated as most important.
See also: Epsilon Lexicase Selection