qual_scatter¶
Function qual_scatter can help you compares the performance of the best configuration with that of selected configurations across a set of instances.
You must provide data in CraceResults format, options in CplotOptions format, the source of data (training or testing) you select for plotting, and selected configurations.
When you provide more than two configurations, it will randomly select two from the provided.
To check more details for its available arguments, call:
import craceplot as cplot
help(cplot.qual_scatter)
Help on function qual_scatter in module craceplot.plots.quality:
qual_scatter(data: 'CraceResults' = None, options: 'CplotOptions' = None, select: 'list' = None, slice: "Union[Literal['budget', 'b', 'B', 'e', 'E', 'experiment', 'time', 't', 'T'], bool, None]" = None, out_dir: 'str' = None, file_name: 'str' = None, title: 'str' = None, num: "Literal['all', 'final', 'elites', None]" = None, source: "Literal['training', 'test', 'testing', None]" = None, _console: 'bool' = True, showfliers: 'bool' = False, showmeans: 'bool' = False, stest: 'bool' = False, dpi: 'int' = 800, xid: 'int' = None, yid: 'int' = None, fontsize: 'int' = 12, fliersize: 'float' = 0.5, fillna: 'bool' = False, penalty: 'float' = 1.2, rpd: 'bool' = True, instance_ids: 'list' = None)
Entrance to generate scatter plots for quality comparison.
:param data: Object CraceResults that must be provided.
:param options: Object CplotOptions that must be provided.
:param select: Optional. A list of experiment, scenario, or method identifiers selected for plotting.
:param slice: Optional. Specifies how the quality data are sliced before plotting. Supported values are 'budget'/'b'/'B', 'experiment'/'e'/'E', 'time'/'t'/'T', or a boolean value.
:param out_dir: Output directory for the generated figure.
:param file_name: File name of the generated figure.
:param title: Optional title of the figure.
:param num: Selects the configurations to include in the plot: 'all', 'final', or 'elites'.
:param source: Selects the source of the results, either 'training' or 'test'/'testing'.
:param showfliers: Whether to display outliers in the scatter plot.
:param showmeans: Whether to display the mean value.
:param stest: Whether to perform statistical tests between the compared groups.
:param dpi: Resolution of the output figure in dots per inch.
:param xid: Identifier of the quality measure plotted on the x-axis.
:param yid: Identifier of the quality measure plotted on the y-axis.
:param fontsize: Font size used in the figure.
:param fliersize: Marker size used for outliers.
:param fillna: Whether to fill missing values before plotting.
:param penalty: Penalty factor applied to missing or invalid quality values.
:param rpd: Whether to use relative percentage deviation for the plotted quality values.
:param instance_ids: Optional list of instance identifiers to include in the plot.
Take ACOTSP for example:
import os
from pathlib import Path
cplot_home = cplot.where()
p = Path(os.path.join(cplot_home, 'inst', 'examples', 'acotsp'))
path_to_acotsp = os.path.relpath(p, Path.cwd())
results, options = cplot.run('-l', path_to_acotsp)
/opt/hostedtoolcache/Python/3.10.22/x64/lib/python3.10/site-packages/craceplot
#---------------------------------------------------------------------------------------------------
# Reading crace plot options...
# Arguments: ['-l', '../../../../../../../../opt/hostedtoolcache/Python/3.10.22/x64/lib/python3.10/site-packages/craceplot/inst/examples/acotsp']
#
# Loading crace plot options...
You can plot with the qual_scatter method:
cplot.qual_scatter(data=results, options=options, source='training', num='elites')
#
# More than two configurations are selected for drawing scatter plot.
# selected configurations: [25, 96]
configuration_id bests 25 96
1 3.297078e+07 3.334691e+07 33310604.0
2 3.230902e+07 3.260211e+07 32568431.0
3 3.236975e+07 3.270024e+07 32645096.0
4 3.262494e+07 3.299474e+07 32899716.0
5 3.252999e+07 3.298572e+07 32650813.0
6 3.267271e+07 3.307386e+07 32815876.0
7 3.268958e+07 3.312408e+07 32814478.0
8 3.270123e+07 3.298522e+07 32973177.0
9 3.253550e+07 3.292888e+07 32908667.0
10 3.301230e+07 3.335485e+07 33309952.0
11 3.248712e+07 3.294075e+07 32721955.0
12 3.298619e+07 3.328104e+07 33210152.0
13 3.264763e+07 3.295563e+07 32913495.0
14 3.271992e+07 3.301147e+07 32927688.0
15 3.277163e+07 3.296852e+07 32934756.0
mean 3.266855e+07 3.301693e+07 32906990.4
Note: bests represents an oracle configuration, constructed by selecting, for each instance,
the configuration that achieves the best performance.