Plots¶
Plots. Needs matplotlib (pip install "ypea[plot]").
convergence draws single runs and front the objective vectors of multi-objective
results. band, boxes and rank_bars draw the results
of an experiment (ypea.experiment.Report calls them). Experiment figures are sized
for one column of a paper (3.5 by 2.6 inches, 8 point text). Save them with
ax.figure.savefig("name.pdf") (or .png, .svg).
convergence ¶
convergence(*results, x='nfe', log=None, ax=None, labels=None, error=False)
Best objective value against evaluations (x="nfe") or iterations (x="iter").
Several results can be drawn on the same axes. With error=True the distance to the
known optimum is drawn. log defaults to True when all values are positive.
Returns the matplotlib Axes.
band ¶
band(x, curves, *, center='median', log=None, ax=None, xlabel='Function evaluations', ylabel='Error', title=None)
Convergence over several runs: curves maps a label to an array (runs, len(x)).
Draws the median (or the mean, with center="mean") of the runs and a band from the
25th to the 75th percentile. log defaults to True when the values are positive and
span more than a factor of 10 (zeros are drawn at the bottom). Returns the Axes.
boxes ¶
boxes(samples, *, log=None, ax=None, ylabel='Final error', title=None)
Box plots of final values: samples maps a label to the values of its runs.
rank_bars ¶
rank_bars(ranks, *, ax=None, ylabel='Average Friedman rank')
Bar chart of average ranks (lower is better): ranks maps a label to its rank.
front ¶
front(*fronts, true_front=None, labels=None, kind=None, ax=None, objectives=None)
Objective vectors of one or more fronts (arrays of shape (n, m), a Front or a
Result), drawn as given, so maximized objectives are not flipped.
Two objectives give a 2D scatter plot and three a 3D scatter plot. More objectives,
or kind="parallel", give parallel coordinates: one line per point across the
objectives. true_front (for example from ypea.benchmarks.multi.pareto_front) is
drawn in gray behind the fronts. objectives names the axes (default f1, f2, ...).
A 3D plot needs ax to be a 3D axes (projection="3d") or None. Returns the Axes.