TensorFlow can also be used to update any iterative algorithm that we can express in a computational graph. One such iterative algorithm is the genetic algorithm, an optimization procedure.
Working with a genetic algorithm
Getting ready
In this recipe, we will illustrate how to implement a simple genetic algorithm. Genetic algorithms are a way to optimize over any parameter space (discrete, continuous, smooth, non-smooth, and so on). The idea is to create a population of randomly initialized solutions, and apply selection, recombination, and mutation to generate new (and potentially better) child solutions. The whole idea rests on the fact that we can calculate the fitness of an individual solution by seeing how well that...