Visualising experiments

This tutorial introduces the built-in plotting utilities defined in plots.py. These functions help you inspect and compare the results of a BLADE experiment.

We assume you have already executed an experiment and saved the results using an ExperimentLogger. Replace results/simple_exp with your own experiment folder.

[ ]:
from iohblade.loggers import ExperimentLogger
from iohblade.plots import plot_convergence, plot_experiment_CEG, plot_code_evolution_graphs, plot_boxplot_fitness, plot_boxplot_fitness_hue, fitness_table, plot_token_usage
logger = ExperimentLogger('results/simple_exp')

Convergence plot

plot_convergence shows the average best fitness over time for all methods on each problem.

[ ]:
plot_convergence(logger)

Code evolution graphs (CEG)

plot_experiment_CEG visualises how code evolves during optimisation. Each run is plotted separately.

[ ]:
plot_experiment_CEG(logger)

plot_code_evolution_graphs is the lower level function used by plot_experiment_CEG. It plots a single run with various complexity metrics.

[ ]:
run_data = logger.get_data().query('method_name == "LLaMEA" and seed == 1')
plot_code_evolution_graphs(run_data, save=False)

Boxplots

Use plot_boxplot_fitness or plot_boxplot_fitness_hue to compare final fitness across methods or problems.

[ ]:
plot_boxplot_fitness(logger)
plot_boxplot_fitness_hue(logger)

Fitness table

fitness_table creates a LaTeX table summarising mean and standard deviation per method/problem.

[ ]:
fitness_table(logger)

Token usage

plot_token_usage shows how many API tokens were consumed by each method.

[ ]:
plot_token_usage(logger)