Visualizing Basic Statistics

Learn how to create a mean fitness vs generation graph of tiger evolution framework.

A mean fitness versus generation graph

In the previous chapter, one of the issues we encountered during your evolution was continuing the algorithm after it had already converged. When we analyzed the mean fitness at different generations, we saw that there was basically no change between the 500th and 1000th generation. This is because the algorithm had already converged.

The easiest way to recognize roughly when the algorithm converges is by creating a graph of mean fitness versus generation. When we do this, we’ll notice a dramatic plateau.

Adding the gnuplot-elixir library

To create a basic graph, we’ll use gnuplot-elixir which is a port of the Gnuplot library. Gnuplot is a library for generating simple plots using the command line. We first need to ensure you have Gnuplot installed. In Ubuntu, we install Gnuplot like this:

$ sudo apt-get install gnuplot

Once it’s installed, we need to add gnuplot-elixir to your dependencies in mix.exs:

Get hands-on with 1200+ tech skills courses.