param_parallelcoord¶
The plot produced by Parcoords from model plotly.graph_objects can help you to both the distribution of the parameter values of a set of configurations and the common associations between these values.
By default, the plot colors the lines using slice_sampled in which slice the configuration is sampled for all configurations in the racing. You can use the colorby argument to choose the parameter for coloring the lines.
To check more details for its available arguments, call:
import craceplot as cplot
help(cplot.param_parallelcoord)
Help on function param_parallelcoord in module craceplot.plots.parameters:
param_parallelcoord(data: 'CraceResults' = None, options: 'CplotOptions' = None, configs: "Union[Literal['all', 'final', 'elites'], list[int], None]" = 'all', parameters: 'Union[list[str], str, None]' = None, colorby: 'str' = None, slice: 'bool' = True, out_dir: 'str' = None, file_name: 'str' = None, tile: 'str' = None, _console: 'bool' = True, showscale: 'bool' = True, shownan: 'bool' = True, nbins: 'int' = 5, width: 'int' = 2560, height: 'int' = 1440, colorscale: 'str' = 'Tealrose', as_html: 'bool' = False)
Entrance to call parallel coord in python console
:param data: object CraceResults that must be provided.
:param options: object CplotOptions that must be provided.
:param configs: Optional. Selected configurations for plotting, higher priority than option numConfigurations/selConfigurations. Supported values are 'all', 'final', 'elites' or a list of configuration IDs. Default is 'all'.
:param parameters: A list of parameter names selected for plotting, higher priority than option multiParameters.
:param colorby: A string of parameter name selected for plotting, higher priority than option keyParameter.
:param showscale: Boolean used to enable/diable showing colorscale.
:param shownan: Boolean used to plot including/excluding missing values.
:param colorscale: A string of palatte name for plotting.
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 do this with the param_parallelcoord method:
cplot.param_parallelcoord(data=results, options=options, as_html=True)
#
# No parameters selected to draw plot, set to the default(random selected 10 parameters).
# selected parameters: algorithm, ants, beta, dlb, elitistants, localsearch, nnls, q0, rasrank, rho
#
# No keyParameter or sel_kvar provided, set colorscale as default.
#
# Mapping parameter type..
# (WARNING: map values of parameter algorithm(c) for ploltting)
# (WARNING: map values of parameter dlb(c) for ploltting)
# (WARNING: map values of parameter localsearch(c) for ploltting)
You can draw more flexible parallel coord plots via providing parameters configs, parameters, colorby, showscale, shownan, colorscale.
cplot.param_parallelcoord(data=results, options=options, configs='elites', colorby='configuration_id',
parameters=['algorithm', 'ants', 'beta', 'dlb', 'elitistants', 'localsearch'],
showscale=False, shownan=False, colorscale='YlGnBu', as_html=True)
#
# Parameter configuration_id is used for colorscale.
#
# Mapping parameter type..
# (WARNING: map values of parameter algorithm(c) for ploltting)
# (WARNING: map values of parameter dlb(c) for ploltting)
# (WARNING: map values of parameter localsearch(c) for ploltting)
Note: when shownan = False but there are missing values in the selected configurations, the missing values would be automatically mapped to a legal value by Parcoords.