LOGGERS#
This module contains the Logger class and related functions for logging accuracy values and other metrics.
Classes#
- class utils.loggers.Logger(args, setting_str, dataset_str, model_str)[source]#
Bases:
object
- add_bwt(results, results_mask_classes)[source]#
Adds backward transfer values.
- Parameters:
results – The results.
results_mask_classes – The results for masked classes.
- add_forgetting(results, results_mask_classes)[source]#
Adds forgetting values.
- Parameters:
results – The results.
results_mask_classes – The results for masked classes.
- add_fwt(results, accs, results_mask_classes, accs_mask_classes)[source]#
Adds forward transfer values.
- Parameters:
results – The results.
accs – The accuracy values.
results_mask_classes – The results for masked classes.
accs_mask_classes – The accuracy values for masked classes.
- dump()[source]#
Dumps the state of the logger in a dictionary.
- Returns:
A dictionary containing the logged values.
- load(dic)[source]#
Loads the state of the logger from a dictionary.
- Parameters:
dic – The dictionary containing the logged values.
- log(mean_acc)[source]#
Logs a mean accuracy value.
- Parameters:
mean_acc (ndarray) – mean accuracy value
- log_fullacc(accs)[source]#
Logs all the accuracy of the classes from the current and past tasks.
- Parameters:
accs – the accuracy values
- log_system_stats(cpu_res, gpu_res)[source]#
Logs the system stats. Supported only if the psutil and torch libraries are installed.
- Parameters:
cpu_res – the CPU memory usage
gpu_res – the GPU memory usage
Functions#
- utils.loggers.log_accs(args, logger, accs, t, setting, epoch=None, prefix='RESULT', future=False)[source]#
Logs the accuracy values and other metrics.
All metrics are prefixed with prefix to be logged on wandb.
- utils.loggers.log_extra_metrics(args, metric, metric_mask_class, metric_name, t, prefix='RESULT')[source]#
Logs the accuracy values and other metrics.
All metrics are prefixed with prefix to be logged on wandb.
- Parameters:
args – The arguments for logging.
metric (float) – Class-IL version of the metric metric_name.
metric_mask_class (float) – Task-IL version of the metric metric_name.
metric_name (str) – The name of the metric.
t (int) – The task index.
epoch – The epoch number (optional).
prefix – The prefix for the metrics (default=”RESULT”).