Loggers
Loggers¶
- class torchmimic.loggers.DecompensationLogger(exp_name, config, log_wandb=False)
Decopensation Logger class. Used for logging, printing, and saving information about the run. Logs AUC-ROC and AUC-PR. Contains built-in wandb support.
- Parameters
config (dict) – A dictionary of the run configuration
log_wandb (bool) – If true, wandb will be used to log metrics and configuration
- get_loss()
Returns average loss
- Returns
Average Loss
- Return type
float
- print_metrics(epoch, split='Train')
Prints and logs metrics. If log_wandb is True, wandb run will be updated
- Parameters
epoch (int) – The current epoch
split (str) – The split of the data. “Train” or “Eval”
- reset()
Resets metrics
- save(model)
Saves the provides models to the experiment path
- update(outputs, labels, loss)
Update Loss, AUC-ROC, and AUC-PR
- Parameters
outputs (torch.Tensor) – Predicted labels
labels (torch.Tensor) – True labels
loss (float) – Loss from the training iteration.
- class torchmimic.loggers.IHMLogger(exp_name, config, log_wandb=False)
In-Hospital-Mortality Logger class. Used for logging, printing, and saving information about the run. Logs AUC-ROC and AUC-PR. Contains built-in wandb support.
- Parameters
config (dict) – A dictionary of the run configuration
log_wandb (bool) – If true, wandb will be used to log metrics and configuration
- get_loss()
Returns average loss
- Returns
Average Loss
- Return type
float
- print_metrics(epoch, split='Train')
Prints and logs metrics. If log_wandb is True, wandb run will be updated
- Parameters
epoch (int) – The current epoch
split (str) – The split of the data. “Train” or “Eval”
- reset()
Resets metrics
- save(model)
Saves the provides models to the experiment path
- update(outputs, labels, loss)
Update Loss, AUC-ROC, and AUC-PR
- Parameters
outputs (torch.Tensor) – Predicted labels
labels (torch.Tensor) – True labels
loss (float) – Loss from the training iteration.
- class torchmimic.loggers.LOSLogger(exp_name, config, log_wandb=False)
Length-of-Stay Logger class. Used for logging, printing, and saving information about the run. Logs loss, Cohen’s Kappa and Mean Absolute Deviation. Contains built-in wandb support.
- Parameters
config (dict) – A dictionary of the run configuration
log_wandb (bool) – If true, wandb will be used to log metrics and configuration
- get_loss()
Returns average loss
- Returns
Average Loss
- Return type
float
- print_metrics(epoch, split='Train')
Prints and logs metrics. If log_wandb is True, wandb run will be updated
- Parameters
epoch (int) – The current epoch
split (str) – The split of the data. “Train” or “Eval”
- reset()
Resets metrics
- save(model)
Saves the provides models to the experiment path
- update(outputs, labels, loss)
Update loss, Cohen’s Kappa and Mean Absolute Deviation
- Parameters
outputs (torch.Tensor) – Predicted labels
labels (torch.Tensor) – True labels
loss (float) – Loss from the training iteration.
- class torchmimic.loggers.PhenotypingLogger(exp_name, config, log_wandb=False)
Phenotyping Logger class. Used for logging, printing, and saving information about the run. Logs loss, AUC-ROC macro, and AUC-ROC micro. Contains built-in wandb support.
- Parameters
config (dict) – A dictionary of the run configuration
log_wandb (bool) – If true, wandb will be used to log metrics and configuration
- get_loss()
Returns average loss
- Returns
Average Loss
- Return type
float
- print_metrics(epoch, split='Train')
Prints and logs metrics. If log_wandb is True, wandb run will be updated
- Parameters
epoch (int) – The current epoch
split (str) – The split of the data. “Train” or “Eval”
- reset()
Resets metrics
- save(model)
Saves the provides models to the experiment path
- update(outputs, labels, loss)
Update loss, AUC-ROC macro, and AUC-ROC micro
- Parameters
outputs (torch.Tensor) – Predicted labels
labels (torch.Tensor) – True labels
loss (float) – Loss from the training iteration.