QDpy
Loading...
Searching...
No Matches
lexicase.py File Reference

Case-wise parent selection for discrete and continuous errors. More...

Go to the source code of this file.

Namespaces

namespace  qdpy

Functions

 qdpy.algorithms.lexicase.lexicase_index (errors, rng, *, epsilon=0.)
 Select one parent from scores, processing cases in a fresh random order.
 qdpy.algorithms.lexicase.novelty_case_counts (outputs, *, history=())
 Count matching outputs independently for each test case.
 qdpy.algorithms.lexicase.novelty_lexicase_index (errors, outputs, rng, *, history=())
 Select one exact lexicase parent using error and output-rarity cases.

Detailed Description

Case-wise parent selection for discrete and continuous errors.

See also
https://arxiv.org/abs/1709.05394

Definition in file lexicase.py.

Function Documentation

◆ lexicase_index()

qdpy.algorithms.lexicase.lexicase_index ( errors,
rng,
* ,
epsilon = 0. )

Select one parent from scores, processing cases in a fresh random order.

Parameters
errorsFinite matrix with candidates as rows and cases as columns.
rngNumPy random generator used for shuffling and tie breaking.
epsilonA nonnegative absolute tolerance, or "mad" for semi-dynamic epsilon-lexicase.
Returns
Row index of the selected candidate.
Minimize errors one case at a time among the remaining candidates.

Zero tolerance implements exact lexicase. With epsilon="mad", a
case's median absolute deviation is computed over the original pool.
The best error is recomputed among the survivors for every case.
Choose uniformly if several candidates remain after the last case.

Definition at line 20 of file lexicase.py.

◆ novelty_case_counts()

qdpy.algorithms.lexicase.novelty_case_counts ( outputs,
* ,
history = () )

Count matching outputs independently for each test case.

Parameters
outputsCandidate rows of hashable output labels.
historyPreviously measured output rows with the same case layout.
Returns
Candidate-by-case matrix of counts, including the current candidate.
Count an output's occurrences in the current population and history.

Choose hashable labels before calling this function. For continuous
outputs, a caller can discretize values to determine what counts as
the same behavior. History participates in counts and stays outside
the selection pool.

Definition at line 66 of file lexicase.py.

◆ novelty_lexicase_index()

qdpy.algorithms.lexicase.novelty_lexicase_index ( errors,
outputs,
rng,
* ,
history = () )

Select one exact lexicase parent using error and output-rarity cases.

See also
https://arxiv.org/abs/1905.09374
Shuffle original error columns and output counts together as cases.

Definition at line 90 of file lexicase.py.