geneticengine.algorithms.gp.operators.seda

Smoothed estimation of distribution for grammar-guided GP.

The model is deliberately independent of a particular genotype encoding: representations provide the production choices made by an individual, and SEDA turns elite choices into smoothed production probabilities.

Classes

SEDA

Learn a smoothed distribution over grammar productions.

Module Contents

class geneticengine.algorithms.gp.operators.seda.SEDA

Learn a smoothed distribution over grammar productions.

samples contains (fitness, choices) pairs. Each choices mapping maps a non-terminal to the productions used while deriving one individual. Lower fitness is considered better when minimize is true.

grammar: geneticengine.grammar.grammar.Grammar
elite_fraction: float = 0.2
smoothing: float = 0.1
minimize: bool = True
probabilities: dict[Any, list[float]]
__post_init__()
estimate(samples)

Estimate production probabilities from the best sample fraction.

Parameters:

samples (collections.abc.Iterable[tuple[float, collections.abc.Mapping[Any, collections.abc.Sequence[Any]]]])

Return type:

None

sample(random, nonterminal)

Sample a production for nonterminal from the learned model.

Parameters:
Return type:

Any