param_sunburst

The plot produced by Sunburst from model plotly.graph_objects can create a pie plot that displays the values of all configurations sampled during the configuration process. This plot can be useful to display the tendencies in the sampling in a simple format. By default, the plot randomly selects 6 parameters for all sampled configurations.

Here, numerical parameters domains are discretized to be shown in the plot. The size of each parameter value in the plot is dependent of the argument textinfo, which could be the count value (value) or percentage (‘percent root’, ‘percent entry’, ‘percent parent’) of configurations having that value in the configurations.

To check more details for its available arguments, call:

import craceplot as cplot

help(cplot.param_sunburst)
Help on function param_sunburst in module craceplot.plots.parameters:

param_sunburst(data: 'CraceResults' = None, options: 'CplotOptions' = None, configs: "Union[Literal['all', 'final', 'elites'], list[int], None]" = 'all', parameters: 'Union[list[str], str, None]' = None, _console: 'bool' = True, shownan: 'bool' = True, nbins: 'int' = 5, palette: 'str' = 'vlag', autosize: 'bool' = True, branchvalues: 'str' = 'total', maxdepth: 'int' = 3, count: 'str' = 'branches', insidetextorientation: 'str' = 'horizontal', textinfo: 'str' = 'label+value', as_html: 'bool' = False)
    Entrance to call sunburst 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. 
                    | Union[Literal['all', 'final', 'elites'], list[int], None]='all'
    :param parameters: A list of parameter names selected for plotting, higher priority than option multiParameters.
    :param shownan: Boolean used to plot including/excluding missing values.
    :param palette:  A string of palatte name for plotting.
    :param branchvalues: parameter of function Sunburst
    :param count: parameter of function Sunburst
    :param insidetextorientation: parameter of function Sunburst
    :param textinfo: paramter of function Sunburst

Take ACOTSP and CATS200 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())

p = Path(os.path.join(cplot_home, 'inst', 'examples', 'cats200'))
path_to_cats200 = os.path.relpath(p, Path.cwd())

results1, options1 = cplot.run('-l', path_to_acotsp)
results2, options2 = cplot.run('-l', path_to_cats200)
/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...
#---------------------------------------------------------------------------------------------------
# Reading crace plot options...
# Arguments: ['-l', '../../../../../../../../opt/hostedtoolcache/Python/3.10.22/x64/lib/python3.10/site-packages/craceplot/inst/examples/cats200']
#
# Loading crace plot options...

You can do this with the param_sunburst method:

cplot.param_sunburst(data=results2, options=options2, as_html=True)
#
# No parameters selected to draw plot, set to the default(random selected 6 parameters).
#    selected parameters: barrier_crossover, mip_cuts_disjunctive, mip_strategy_bbinterval, network_pricing, simplex_crash, simplex_tolerances_markowitz

You can draw more flexible plots via providing parameters configs, parameters, palette, shownan, branchvalues, count, insidetextorientation and textinfo.

cplot.param_sunburst(data=results1, options=options1, configs='elites',
                     parameters=['algorithm', 'q0', 'dlb', 'elitistants', 'nnls'],
                     shownan=False, palette='YlGnBu',
                     branchvalues='total', count='leaves',
                     insidetextorientation='auto',
                     textinfo='label+percent parent',
                     as_html=True)