Skip to main content

Module shaping

Module shaping 

Source
Expand description

Fitness shaping transforms.

Strategies occasionally benefit from monotone transforms of raw fitness values: centered-rank mapping flattens outliers, z-scoring normalizes scale across generations, and weight decay penalizes large-norm genomes (common in neuroevolution). These helpers work directly on device tensors and are pure functions (RNG-free).

Enums§

ShapingError
Error returned by fallible fitness-shaping transforms.

Functions§

centered_rank
Returns centered ranks: the largest fitness maps to +0.5, the smallest to -0.5, with linear spacing in between.
z_score
Returns fitness - fitness.mean() divided by the (population) std-dev, clamped to avoid divide-by-zero when all fitnesses are equal.