ncalab.training.traininghistory =============================== .. py:module:: ncalab.training.traininghistory Classes ------- .. autoapisummary:: ncalab.training.traininghistory.TrainingStatus ncalab.training.traininghistory.TrainingHistory Module Contents --------------- .. py:class:: TrainingStatus(*args, **kwds) Bases: :py:obj:`enum.Enum` Encodes last status of the training. .. py:attribute:: STATUS_NONE :value: 0 .. py:attribute:: STATUS_RUNNING :value: 1 .. py:attribute:: STATUS_DONE :value: 2 .. py:class:: TrainingHistory(path: Optional[pathlib.Path | pathlib.PosixPath], metrics: Dict[str, float], current_epoch: int, current_model: ncalab.models.AbstractNCAModel, best_accuracy: float = 0, best_epoch: int = 0, best_model: Optional[ncalab.models.AbstractNCAModel] = None, verbose: bool = True) Stores data about the training progress. Populated during training with ncalab.training.BasicNCATrainer. :param path: Save and load path. :type path: Optional[Path | PosixPath] :param metrics: Dict of validation metrics :type metrics: Dict[str, float] :param current_epoch: Current training epoch. :type current_epoch: int :param current_model: Currently trained model. :type current_model: AbstractNCAModel :param best_accuracy: Best validation accuracy, defaults to 0 :type best_accuracy: float, optional :param best_epoch: Epoch of best validation accuracy, defaults to 0 :type best_epoch: int, optional :param best_model: Model with best validation accuracy, defaults to None :type best_model: Optional[AbstractNCAModel], optional :param verbose: Whether to print updates of validation accuracy, defaults to True :type verbose: bool, optional .. py:attribute:: path .. py:attribute:: metrics .. py:attribute:: current_epoch .. py:attribute:: current_model .. py:attribute:: best_accuracy :value: 0 .. py:attribute:: best_epoch :value: 0 .. py:attribute:: best_model :value: None .. py:attribute:: verbose :value: True .. py:attribute:: created_timestamp .. py:attribute:: modified_timestamp .. py:attribute:: loss :type: List[float] :value: [] .. py:method:: update(epoch: int, model: ncalab.models.AbstractNCAModel, accuracy: float, overwrite: bool = False) Populates history with current iteration's values. Automatically recognizes changes in accuracy. :param epoch: Current epoch :type epoch: int :param model: Current model :type model: AbstractNCAModel :param accuracy: Current accuracy, based on model's validation metric :type accuracy: float :param overwrite: Whether to overwrite best accuracy even with no improvement, defaults to False :type overwrite: bool, optional .. py:method:: save() Saves history and model checkpoint. .. py:method:: to_dict() -> Dict Return dict of recorded values :return: Dict of recorded values :rtype: Dict