Keras optimizer implementation of NEAT.
Use this when training a Keras model through model.compile(...).
Important constructor arguments:
learning_rate: step sizealpha: scale of the Nash correction estimatebeta: momentum mixing factornce_mode: one ofprojection,cosine, oroffweight_decay: weight decay coefficientdecouple_weight_decay: whether weight decay is decoupled from the momentum updatence_clip_ratio: clips the correction norm relative to the gradient normopponent_source:momentum,previous_gradient, orgradient_emaopponent_ema_decay: decay factor used bygradient_emacorrection_warmup_steps: steps to wait before applying the correctionconflict_threshold: minimum conflict ratio required before correctionsparsity_l1: optional soft-threshold shrinkage for sparse weightsprune_threshold: optional hard pruning threshold
Diagnostics:
diagnostic_snapshot(): returns aggregate optimizer diagnostics gathered during trainingreset_diagnostics(): clears those running aggregates
Immutable configuration object for the reference and functional engines.
Use this when working with neat_step(...) directly or when serializing
optimizer configuration outside Keras.
Per-parameter state container for the NumPy and functional engines.
Fields:
momentumnceprevious_gradientgradient_emastep
Create a zero-initialized state with ArrayState.zeros_like(array).
Configuration object for explicit per-player updates.
Additional arguments:
opponent_mode:mean_excluding_selforbatch_meanplayer_reduction:meanorsumsparsity_l1: soft-threshold sparsity pressureprune_threshold: hard-prune threshold
Explicit player-aware one-step API.
Inputs:
- parameter array
player_gradswith shape(num_players, *param.shape)ArrayStatePlayerNEATConfig
Returns a PlayerStepResult containing:
- updated parameter tensor
- updated state
- player-conflict and sparsity diagnostics
TensorFlow helper for custom training loops with per-example gradients.
Use this when you want each training example in a batch to act as a player. This requires a loss function that returns unreduced per-example losses.
Framework-agnostic one-step API for NEAT updates.
Inputs:
- parameter array
- gradient array
ArrayStateNEATConfig
Returns a StepResult containing:
- updated parameter tensor
- updated state
- scalar metrics for the step, including conflict ratio, correction ratio, update alignment, and opponent norm
NEAT.get_config()supports standard Keras optimizer serialization.NEATConfig.as_dict()returns a plain serializable configuration mapping.PlayerNEATConfig.as_dict()does the same for the player-aware mode.ArrayStateis intended for the reference NumPy engine and test fixtures, not for framework checkpoint interchange.
ConfigurationError: invalid optimizer configurationNativeCoreUnavailableError: native engine requested but not available