dacapo.store.file_stats_store
Attributes
Classes
A File based store for run statistics. Used to store and retrieve training statistics and validation scores. |
Module Contents
- dacapo.store.file_stats_store.logger
- class dacapo.store.file_stats_store.FileStatsStore(path)
A File based store for run statistics. Used to store and retrieve training statistics and validation scores.
The store is organized as follows: - A directory for training statistics, with a subdirectory for each run. Each run directory contains a pickled list of TrainingIterationStats objects. - A directory for validation scores, with a subdirectory for each run. Each run directory contains a pickled list of ValidationIterationScores objects.
Attributes: - path: The root directory for the store. - training_stats: The directory for training statistics. - validation_scores: The directory for validation scores.
Methods: - store_training_stats(run_name, stats): Store the training statistics for a run. - retrieve_training_stats(run_name): Retrieve the training statistics for a run. - store_validation_iteration_scores(run_name, scores): Store the validation scores for a run. - retrieve_validation_iteration_scores(run_name): Retrieve the validation scores for a run. - delete_training_stats(run_name): Delete the training statistics for a run.
Note: The store does not support concurrent access. It is intended for use in single-threaded applications.
- path
- store_training_stats(run_name, stats)
Stores the training statistics for a specific run.
- Parameters:
run_name (str) – The name of the run.
stats (Stats) – The training statistics to be stored.
- Raises:
ValueError – If the run name is invalid.
Examples
>>> store.store_training_stats("run1", stats)
Notes
If the training statistics for the given run already exist in the database, the method will compare the existing statistics with the new statistics and update or overwrite them accordingly.
If the new statistics go further than the existing statistics, the method will update the statistics from the last stored iteration.
If the new statistics are behind the existing statistics, the method will overwrite the existing statistics.
- retrieve_training_stats(run_name)
Retrieve the training statistics for a specific run.
- Parameters:
run_name (str) – The name of the run for which to retrieve the training statistics.
- Returns:
A dictionary containing the training statistics for the specified run.
- Return type:
dict
- store_validation_iteration_scores(run_name, scores)
Stores the validation scores for a specific run.
- Parameters:
run_name (str) – The name of the run.
scores (Scores) – The validation scores to be stored.
- Raises:
ValueError – If the run name is invalid.
Examples
>>> store.store_validation_iteration_scores("run1", scores)
Notes
If the validation scores for the given run already exist in the database, the method will compare the existing scores with the new scores and update or overwrite them accordingly.
If the new scores go further than the existing scores, the method will update the scores from the last stored iteration.
If the new scores are behind the existing scores, the method will overwrite the existing scores.
- retrieve_validation_iteration_scores(run_name)
Retrieve the validation iteration scores for a given run.
- Parameters:
run_name (str) – The name of the run for which to retrieve the validation iteration scores.
- Returns:
A list of validation iteration scores.
- Return type:
list
- Raises:
ValueError – If the run name is invalid.
Examples
>>> store.retrieve_validation_iteration_scores("run1")