:py:mod:`orcanet.history` ========================= .. py:module:: orcanet.history Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: orcanet.history.HistoryHandler .. py:class:: HistoryHandler(main_folder) For reading and plotting data from summary and train log files. .. !! processed by numpydoc !! .. py:property:: summary_file .. py:property:: train_log_folder .. py:method:: plot_metric(metric_name, **kwargs) Plot the training and validation history of a metric. This will read out data from the summary file, as well as all training log files, and plot them over the epoch. :Parameters: **metric_name** : str Name of the metric to be plotted over the epoch. This name is what was written in the head line of the summary.txt file, except without the train_ or val_ prefix. **kwargs** Keyword arguments for the plot_history function. .. !! processed by numpydoc !! .. py:method:: plot_lr(**kwargs) Plot the learning rate over the epochs. :Parameters: **kwargs** Keyword arguments for the plot_history function. :Returns: **fig** : matplotlib.figure.Figure The plot. .. !! processed by numpydoc !! .. py:method:: get_metrics() Get the name of the metrics from the first line in the summary file. This will be the actual name of the metric, i.e. "loss" and not "train_loss" or "val_loss". :Returns: **all_metrics** : List A list of the metrics. .. !! processed by numpydoc !! .. py:method:: get_summary_data() Read out the summary file in the output folder. :Returns: **summary_data** : ndarray Numpy structured array with the column names as datatypes. Its shape is the number of lines with data. .. !! processed by numpydoc !! .. py:method:: get_best_epoch_info(metric='val_loss', mini=True) Get the line in the summary file where the given metric is best, i.e. either minimal or maximal. :Parameters: **metric** : str Which metric to look up. **mini** : bool If true, look up the minimum. Else the maximum. :Raises: ValueError If there is no best line (e.g. no validation has been done). .. !! processed by numpydoc !! .. py:method:: get_best_epoch_fileno(metric='val_loss', mini=True) Get the epoch/fileno tuple where the given metric is smallest. .. !! processed by numpydoc !! .. py:method:: get_column_names() Get the str in the first line in each column. :Returns: **tuple** : column_names The names in the same order as they appear in the summary.txt. .. !! processed by numpydoc !! .. py:method:: get_train_data() Read out all training logfiles in the output folder. Read out the data from the summary.txt file, and from all training log files in the train_log folder, which is in the same directory as the summary.txt file. :Returns: **summary_data** : numpy.ndarray Structured array containing the data from the summary.txt file. Its shape is the number of lines with data. .. !! processed by numpydoc !! .. py:method:: get_state() Get the state of a training. For every line in the summary logfile, get a dict with the epoch as a float, and is_trained and is_validated bools. :Returns: **state_dicts** : List List of dicts. .. !! processed by numpydoc !!