Graphical Analysis - Plots¶

Pyevolve comes with an Graphical Plotting Tool, this utility uses the great python plotting library called Matplotlib.

See also Requirements section.

You can find the Pyevolve plotting tool in your python Scripts directory, the tool is named pyevolve_graph.py.

Graphical Plotting Tool Options¶ pyevolve_graph.py, installed in \Python2x\Scripts\pyevolve_graph.py . This is the documentation where you call the –help option: Usage: pyevolve_graph.py [options] Options: -h, --help show this help message and exit -f FILENAME, --file=FILENAME Database file to read (default is 'pyevolve.db'). -i IDENTIFY, --identify=IDENTIFY The identify of evolution. -o OUTFILE, --outfile=OUTFILE Write the graph image to a file (don't use extension, just the filename, default is png format, but you can change using --extension (-e) parameter). -e EXTENSION, --extension=EXTENSION Graph image file format. Supported options (formats) are: emf, eps, pdf, png, ps, raw, rgba, svg, svgz. Default is 'png'. -g GENRANGE, --genrange=GENRANGE This is the generation range of the graph, ex: 1:30 (interval between 1 and 30). -c COLORMAP, --colormap=COLORMAP Sets the Color Map for the graph types 8 and 9. Some options are: summer, bone, gray, hot, jet, cooper, spectral. The default is 'jet'. -m, --minimize Sets the 'Minimize' mode, default is the Maximize mode. This option makes sense if you are minimizing your evaluation function. Graph types: This is the supported graph types -0 Write all graphs to files. Graph types: 1, 2, 3, 4 and 5. -1 Error bars graph (raw scores). -2 Error bars graph (fitness scores). -3 Max/min/avg/std. dev. graph (raw scores). -4 Max/min/avg graph (fitness scores). -5 Raw and Fitness min/max difference graph. -6 Compare best raw score of two or more evolutions (you must specify the identify comma-separed list with --identify (-i) parameter, like 'one, two, three'), the maximum is 6 items. -7 Compare best fitness score of two or more evolutions (you must specify the identify comma-separed list with --identify (-i) parameter, like 'one, two, three'), the maximum is 6 items. -8 Show a heat map of population raw score distribution between generations. -9 Show a heat map of population fitness score distribution between generations.

Usage¶ To use this graphical plotting tool, you need to use the DBAdapters.DBSQLite adapter and create the database file. Pyevolve have the “identify” concept, the value of this parameter means the same value used in the “identify” parameter of the DB Adapter. See this example: sqlite_adapter = DBAdapters . DBSQLite ( identify = "ex1" ) ga . setDBAdapter ( sqlite_adapter ) This DB Adapter attached to the GA Engine will create the database file named “pyevolve.db”. See also Sqliteman, a tool for sqlite3 databases I recommend the Sqliteman tool to open the database and see the contents or structure, if you are interested. When you run your GA, all the statistics will be dumped to this database, and you have an ID for this run, which is the identify parameter. So when you use the graph tool, it will read the statistics from this database file. The “identify” parameter is passed to the tool using the “-i” option, like this: pyevolve_graph.py -i ex1 -1 By default, this tool will use the database file named pyevolve.db, but you can change using the “-f” option like this: pyevolve_graph.py -i ex1 -1 -f another_db.db

Usage Examples¶ Writing graph to a file PDF File: pyevolve_graph.py -i ex1 -1 -o graph_ex1 -e pdf PNG File (default extension when using “-o” option): pyevolve_graph.py -i ex1 -1 -o graph_ex1 Using the generation range # this command wil plot the evoltion of the generations between 10 and 20. pyevolve_graph.py -i ex1 -1 -g 10:20 When you have minimized the evaluation function pyevolve_graph.py -i ex1 -1 -m To specify an identify list (graphs “-6” and “-7”) pyevolve_graph.py -i ex1_run1,ex1_run2,ex1_run3 -6s