LION.evaluation.figures

Figures of test records: score plots and example images, in plain matplotlib (your style sheet and rcParams apply).

  • per_sample(records, metric): each method’s per-sample scores, and per_sample_differences(records, metric, baseline): each method’s minus the baseline’s, sample by sample: the data, for any plot;

  • box_plot and difference_plot: those as box plots (ax.boxplot);

  • chosen_samples(record): the samples where a method (the baseline) does best, median and worst;

  • reconstructions(evaluation, methods, ids) and example_images(...): the targets and each method’s images of some samples, in one grey window, with zoomed crops and differences to the target if asked.

Plots take ax= (draw into your figure) and return the Figure. matplotlib is imported only here, so LION.evaluation imports without it.

Functions

box_plot(records, metric[, ax])

Each method's per-sample metric (per_sample), one box each.

chosen_samples(record[, metric])

{"best": id, "median": id, "worst": id}: the samples where record's method scores best, median and worst on metric (default: the first).

difference_plot(records, metric, baseline[, ax])

Each method's per-sample metric minus the baseline's (per_sample_differences), one box each, with a line at 0.

example_images(targets, outputs[, ...])

The targets and each method's images, one row per sample (the target first, then the methods), in one grey window: data_range ((min, max); None: each target's own).

per_sample(records, metric)

{name: [score of each sample]} of each record, in order.

per_sample_differences(records, metric, baseline)

{name: [score - baseline's score, per sample]} of each record but the baseline's (the record named baseline), matched by sample ID.

reconstructions(evaluation, methods, ids[, ...])

The targets and each method's images of the samples ids (of evaluation's test data), as 2D CPU tensors: (targets, outputs), targets[id] and outputs[name][id].


LION.evaluation.figures.box_plot(records, metric, ax=None)[source]

Each method’s per-sample metric (per_sample), one box each.

LION.evaluation.figures.chosen_samples(record, metric=None)[source]

{"best": id, "median": id, "worst": id}: the samples where record’s method scores best, median and worst on metric (default: the first).

LION.evaluation.figures.difference_plot(records, metric, baseline, ax=None)[source]

Each method’s per-sample metric minus the baseline’s (per_sample_differences), one box each, with a line at 0.

LION.evaluation.figures.example_images(targets, outputs, data_range=None, zoom=None, differences=False, labels=None, scores=None, zoom_color='C1')[source]

The targets and each method’s images, one row per sample (the target first, then the methods), in one grey window: data_range ((min, max); None: each target’s own).

zoom: [(row, col, height, width), ...] in pixels: each region is outlined and shown enlarged in a row below. differences: a row of each method’s image minus the target. labels: {id: row label}. scores: {name: {id: text}} written under the images. zoom_color: of the outlines (default: the second colour of your colour cycle).

LION.evaluation.figures.per_sample(records, metric)[source]

{name: [score of each sample]} of each record, in order.

LION.evaluation.figures.per_sample_differences(records, metric, baseline)[source]

{name: [score - baseline's score, per sample]} of each record but the baseline’s (the record named baseline), matched by sample ID.

LION.evaluation.figures.reconstructions(evaluation, methods, ids, allow=())[source]

The targets and each method’s images of the samples ids (of evaluation’s test data), as 2D CPU tensors: (targets, outputs), targets[id] and outputs[name][id].