ast_toolbox.algos.gasm module

class ast_toolbox.algos.gasm.GASM(step_size=0.01, **kwargs)[source]

Bases: ast_toolbox.algos.ga.GA

Deep Genetic Algorithm [1] with Safe Mutation [2].

Parameters:
  • step_size (float, optional) – The constraint on the KL divergence of each mutation.
  • kwargs – Keyword arguments passed to ast_toolbox.algos.ga.GA.

References

[1]Such, Felipe Petroski, et al. “Deep neuroevolution: Genetic algorithms are a competitive alternative for
training deep neural networks for reinforcement learning.”
arXiv preprint arXiv:1712.06567 (2017).
[2]Lehman, Joel, et al. “Safe mutations for deep and recurrent neural networks through output gradients.” Proceedings of the Genetic and Evolutionary Computation Conference. 2018.
data2inputs(samples_data)[source]

Transfer the processed data samples to training inputs

Parameters:samples_data (dict) – The processed data samples
Returns:all_input_values (tuple) – The input used in training
extra_recording(itr)[source]

Record extra training statistics per-iteration.

Parameters:itr (int) – The iteration number.
init_opt()[source]

Initiate trainer internal tensorflow operations.

mutation(itr, new_seeds, new_magnitudes, all_paths)[source]

Generate new random seeds and magnitudes for the next generation.

The first self.keep_best seeds are set to no-mutation value (0).

Parameters:
  • itr (int) – The iteration number.
  • new_seeds (numpy.ndarry) – The original seeds.
  • new_magnitudes (numpy.ndarry) – The original magnitudes.
  • all_paths (list[dict]) – The collected paths from the sampler.
Returns:

  • new_seeds (numpy.ndarry) – The new seeds.
  • new_magnitudes (numpy.ndarry) – The new magnitudes.