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