bob.ip.common.utils.plot

Functions

loss_curve(df)

Creates a loss curve in a Matplotlib figure.

precision_recall_f1iso(data, limits)

Creates a precision-recall plot

bob.ip.common.utils.plot.precision_recall_f1iso(data, limits)[source]

Creates a precision-recall plot

This function creates and returns a Matplotlib figure with a precision-recall plot. The plot will be annotated with F1-score iso-lines (in which the F1-score maintains the same value).

This function specially supports “second-annotator” entries by plotting a line showing the comparison between the default annotator being analyzed and a second “opinion”. Second annotator dataframes contain a single entry (threshold=0.5), given the nature of the binary map comparisons.

Parameters
  • data (dict) –

    A dictionary in which keys are strings defining plot labels and values are dictionaries with two entries:

    • df: pandas.DataFrame

      A dataframe that is produced by our evaluator engine, indexed by integer “thresholds”, containing the following columns: threshold, tp, fp, tn, fn, mean_precision, mode_precision, lower_precision, upper_precision, mean_recall, mode_recall, lower_recall, upper_recall, mean_specificity, mode_specificity, lower_specificity, upper_specificity, mean_accuracy, mode_accuracy, lower_accuracy, upper_accuracy, mean_jaccard, mode_jaccard, lower_jaccard, upper_jaccard, mean_f1_score, mode_f1_score, lower_f1_score, upper_f1_score, frequentist_precision, frequentist_recall, frequentist_specificity, frequentist_accuracy, frequentist_jaccard, frequentist_f1_score.

    • threshold: list

      A threshold to graph with a dot for each set. Specific threshold values do not affect “second-annotator” dataframes.

  • limits (tuple) – A 4-tuple containing the bounds of the plot for the x and y axis respectively (format: [x_low, x_high, y_low, y_high]). If not set, use normal bounds ([0, 1, 0, 1]).

Returns

figure – A matplotlib figure you can save or display (uses an agg backend)

Return type

matplotlib.figure.Figure

bob.ip.common.utils.plot.loss_curve(df)[source]

Creates a loss curve in a Matplotlib figure.

Parameters

df (pandas.DataFrame) – A dataframe containing, at least, “epoch”, “median-loss” and “learning-rate” columns, that will be plotted.

Returns

figure – A figure, that may be saved or displayed

Return type

matplotlib.figure.Figure