mlair.plotting.training_monitoring

Plots to monitor training.

Module Contents

Classes

PlotModelHistory

Plot history of all plot_metrics (default: loss) for a training event.

PlotModelLearningRate

Plot the behaviour of the learning rate in dependence of the number of epochs.

Attributes

__author__

__date__

history_object

lr_object

mlair.plotting.training_monitoring.__author__ = Felix Kleinert, Lukas Leufen
mlair.plotting.training_monitoring.__date__ = 2019-12-11
mlair.plotting.training_monitoring.history_object
mlair.plotting.training_monitoring.lr_object
class mlair.plotting.training_monitoring.PlotModelHistory(filename: str, history: history_object, plot_metric: str = 'loss', main_branch: bool = False, epoch_best: int = None)

Plot history of all plot_metrics (default: loss) for a training event.

For default plot_metric and val_plot_metric are plotted. If further metrics are provided (name must somehow include the word <plot_metric>), this additional information is added to the plot with an separate y-axis scale on the right side (shared for all additional metrics). The plot is saved locally. For a proper saving behaviour, the parameter filename must include the absolute path for the plot.

_get_plot_metric(self, history, plot_metric, main_branch, correct_names=True)
_filter_columns(self, history: Dict) → List[str]

Select only columns named like %<plot_metric>%.

The default metrics ‘<plot_metric>’ and ‘val_<plot_metric>’ are removed too.

Parameters

history – a dict with at least ‘<plot_metric>’ and ‘val_<plot_metric>’ as keys (can be derived from keras History.history)

Returns

filtered columns including all plot_metric variations except <plot_metric> and val_<plot_metric>.

_plot(self, filename: str)None

Create plot.

Plots <plot_metric> and val_<plot_metric> as default. If more plot_metrics are provided, they will be added with an additional yaxis on the right side. The plot is saved in filename.

Parameters

filename – name (including total path) of the plot to save.

class mlair.plotting.training_monitoring.PlotModelLearningRate(filename: str, lr_sc: lr_object)

Plot the behaviour of the learning rate in dependence of the number of epochs.

The plot is saved locally as pdf. For a proper saving behaviour, the parameter filename must include the absolute path for the plot.

_plot(self, filename: str)None

Create plot.

Plot the learning rate in dependence of epoch.

Parameters

filename – name (including total path) of the plot to save.