actsnclass.Canvas
- class actsnclass.Canvas
Canvas object, handles and plot information from multiple strategies.
- Variables:
axis_label_size (int) – Size of font in axis labels.
canonical (pd.DataFrame) – Data from Canonical strategy.
fig_size (tuple) – Figure dimensions.
rand_sampling (pd.DataFrame) – Data from Random Sampling strategy.
tick_label_size (int) – Size of tick labels in both axis.
ncolumns (int) – Number of columns in panel grid.
nlines (int) – Number of lines in panel grid.
nmetrics (int) – Number of metric elements (panels in plot).
metrics_names (list) – List of names for metrics to be plotted.
unc_sampling (pd.DataFrame) – Data from Uncertainty Sampling strategy.
colors (dict) – Colors corresponding to each strategy. They were chosen to follow Mondrian’s color palette. Do not change and try to keep the same palette in adding new elements.
labels (dict) – Labels to appear on plot for each strategy.
markers (dict) – Plot markers for each strategy.
strategies (dict) – Dictionary connecting each data frame to its standard nomenclature (not the plot labels).
- load_metrics(path_to_files: list, strategy_list: list)
Load metrics and identify set of metrics.
- set_plot_dimensions()
Set directives for plot sizes based on number of metrics.
- plot_metrics(output_plot_file: str, strategies_list: list)
Generate plot for all metrics in files and strategies given as input.
Examples
Define input variables
>>> path_to_files = ['results/metrics_canonical.dat', >>> 'results/metrics_random.dat', >>> 'results/metrics_unc.dat'] >>> strategies_list = ['Canonical', 'RandomSampling', 'UncSampling'] >>> output_plot = 'plots/metrics1_unc.png'
Initiate the Canvas object, read and plot the results for each metric and strategy.
>>> cv = Canvas() >>> cv.load_metrics(path_to_files=path_to_files, >>> strategies_list=strategies_list) >>> cv.set_plot_dimensions() >>> cv.plot_metrics(output_plot_file=output_plot, >>> strategies_list=strategies_list)
- __init__()
Methods
__init__()load_metrics(path_to_files, strategies_list)Load and identify set of metrics.
plot_metrics(output_plot_file, strategies_list)Generate plot for all metrics in files and strategies given as input.
Set directives for plot sizes.