Plotting functions¶
- iohblade.plots.fitness_table(logger: ExperimentLogger, alpha=0.05, smaller_is_better=False)¶
Creates a LaTeX table with rows = methods, columns = problems. Each cell shows mean ± std (p=…). Cells are bolded if that method is significantly better than all others (p < alpha) for the given problem.
- Args:
logger (ExperimentLogger): the experiment logger to process. alpha (float): Significance level for p-value cutoff. smaller_is_better (bool): If True, we treat lower fitness as “better.” Otherwise, higher is “better.”
- iohblade.plots.normalize_key(key)¶
Converts any feature key to a standardized format (e.g., ‘mean_complexity’ -> ‘mean complexity’).
- iohblade.plots.plot_boxplot_fitness(logger: ExperimentLogger, y_label='Fitness', x_label='Method', problems=None)¶
Plots boxplots of fitness grouped by problem_name (subplots) and method_name (categories). Each problem has its own subplot, grouped by method_name.
- Args:
logger y_label x_label problems
- iohblade.plots.plot_boxplot_fitness_hue(logger: ExperimentLogger, y_label='Fitness', x_label='Problem', hue='method_name', x='problem_name', problems=None)¶
Plots boxplots of fitness grouped by hue and method_name x. Produces one plot with grouped boxplots per x. Args:
logger
- iohblade.plots.plot_code_evolution_graphs(run_data, expfolder=None, plot_features=None, markersize=None, save=True, ax=None)¶
Plots optimization progress and relationships between successive solutions in an evolutionary run based on AST metrics. Can plot multiple features or a single feature on a provided axis.
- Args:
run_data (pandas.DataFrame): DataFrame containing code and fitness values. expfolder (str, optional): Folder path where the plots are saved. If None, plots are shown. plot_features (list, optional): The features to plot. If None, plots multiple default features. markersize (int. optional): The size of the markers, if not set it will be dynamic based on the degree. save (bool): If True, saves the plots otherwise shows them. ax (matplotlib.axes.Axes, optional): The axis to plot on. If None, creates new plots.
- iohblade.plots.plot_convergence(logger: ExperimentLogger, metric: str = 'Fitness', aggregation: str = 'mean', variance_aggregation: str = 'std', methods: list = None, budget: int = 100, save: bool = True, return_fig: bool = False, separate_lines: bool = False, show_std: bool = True)¶
Plots the convergence of all methods for each problem from an experiment log.
- Args:
logger (ExperimentLogger): The experiment logger object. metric (str, optional): The metric to show as y-axis label. aggregation (str, optional): The aggregation method to use (‘mean’, ‘median’, etc.). variance_aggregation (str, optional): The method to aggregate variance (‘std’, ‘sem’, etc.). methods (list, optional): List of method names to include. If None, includes all methods. budget (int, optional): The maximum number of evaluations to display on the x-axis. save (bool, optional): Whether to save or show the plot. return_fig (bool, optional): Whether to return the figure object. separate_lines (bool, optional): If True, plots each run using separate line. show_std (bool, optional): If True, shows standard deviation as shaded area.
- iohblade.plots.plot_experiment_CEG(logger: ExperimentLogger, metric: str = 'total_token_count', methods=None, markersize=None, budget: int = 100, save: bool = True, max_seeds=5)¶
Plot the Code evolution graphs for each run in an experiment, splitted by problem.
- Args:
logger (ExperimentLogger): The experiment logger object. metric (str, optional): The metric to show as y-axis label (should be a statistic from AST / Complexity). methods (list, optional): An optional list of method names to plot, if None, all methods are included. markersize (int. optional): The size of the markers, if not set it will be dynamic based on the degree. budget (int): The number of evaluations to plot. save (bool, optional): Whether to save or show the plot. max_seeds (int, optional): The maximum number of runs to plot.
- iohblade.plots.plot_speedup(logger: ExperimentLogger, method_fast: str, method_slow: str, aggregation: str = 'mean', variance_aggregation: str = 'std', budget: int = 100, save: bool = True, return_fig: bool = False)¶
Plots speed-up of method_fast over method_slow.
Speed-up definition: If method_fast reaches fitness x at n evaluations and method_slow reaches fitness x at m evaluations, speed-up = m / n.
- Args:
logger (ExperimentLogger) method_fast (str): numerator algorithm method_slow (str): denominator algorithm aggregation (str): mean / median variance_aggregation (str): std / sem budget (int): max evaluations save (bool) return_fig (bool)
- iohblade.plots.plot_token_usage(logger: ExperimentLogger, save: bool = True, return_fig: bool = False, return_df: bool = False)¶
Plot total tokens used per method/problem from an experiment logger.
- iohblade.plots.plotly_code_evolution(run_data: DataFrame, feature: str = 'total_token_count') Figure¶
Create an interactive code evolution graph using Plotly.
- iohblade.plots.safe_parse_parent_ids(x)¶