Tensorboard eval
neps.plot.tensorboard_eval
#
The tblogger module provides a simplified interface for logging to TensorBoard.
SummaryWriter_
#
Bases: SummaryWriter
This class inherits from the base SummaryWriter class and provides modifications to improve the logging. It simplifies the logging structure and ensures consistent tag formatting for metrics.
Changes Made: - Avoids creating unnecessary subfolders in the log directory. - Ensures all logs are stored in the same 'tfevent' directory for better organization. - Updates metric keys to have a consistent 'Summary/' prefix for clarity. - Improves the display of 'Loss' or 'Accuracy' on the Summary file.
Methods: - add_hparams: Overrides the base method to log hyperparameters and metrics with better formatting.
add_hparams
#
Add a set of hyperparameters to be logged.
Source code in neps/plot/tensorboard_eval.py
tblogger
#
The tblogger class provides a simplified interface for logging to tensorboard.
logger_bool
class-attribute
#
logger_bool: bool = False
logger_bool is true only if tblogger.log is used by the user, this allows to always capturing the configuration data.
disable
staticmethod
#
The function allows for disabling the logger functionality. When the logger is disabled, it will not perform logging operations.
By default tblogger is enabled when used.
Source code in neps/plot/tensorboard_eval.py
enable
staticmethod
#
The function allows for enabling the logger functionality. When the logger is enabled, it will perform the logging operations.
By default this is enabled.
Source code in neps/plot/tensorboard_eval.py
end_of_config
staticmethod
#
Closes the writer.
Source code in neps/plot/tensorboard_eval.py
get_status
staticmethod
#
get_status() -> bool
Returns the currect state of tblogger ie. whether the logger is enabled or not.
image_logging
staticmethod
#
image_logging(
image: Tensor,
counter: int = 1,
*,
resize_images: list[None | int] | None = None,
random_images: bool = True,
num_images: int = 20,
seed: int | RandomState | None = None
) -> tuple[
str,
Tensor,
int,
list[None | int] | None,
bool,
int,
int | RandomState | None,
]
Prepare an image tensor for logging.
PARAMETER | DESCRIPTION |
---|---|
image |
Image tensor to be logged.
TYPE:
|
counter |
Counter value associated with the images.
TYPE:
|
resize_images |
List of integers for image sizes after resizing. |
random_images |
Images are randomly selected if True.
TYPE:
|
num_images |
Number of images to log.
TYPE:
|
seed |
Seed value or RandomState instance to control randomness.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
tuple[str, Tensor, int, list[None | int] | None, bool, int, int | RandomState | None]
|
A tuple containing the logging mode and all the necessary parameters for image logging. Tuple: (logging_mode, img_tensor, counter, resize_images, random_images, num_images, seed). |
Source code in neps/plot/tensorboard_eval.py
log
staticmethod
#
log(
loss: float,
current_epoch: int,
*,
writer_config_scalar: bool = True,
writer_config_hparam: bool = True,
write_summary_incumbent: bool = False,
extra_data: dict | None = None
) -> None
Log experiment data to the logger, including scalar values, hyperparameters, and images.
PARAMETER | DESCRIPTION |
---|---|
loss |
Current loss value.
TYPE:
|
current_epoch |
Current epoch of the experiment (used as the global step).
TYPE:
|
writer_config_scalar |
Displaying the loss or accuracy curve on tensorboard (default: True)
TYPE:
|
writer_config_hparam |
Write hyperparameters logging of the configs.
TYPE:
|
write_summary_incumbent |
Set to
TYPE:
|
extra_data |
Additional experiment data for logging.
TYPE:
|
Source code in neps/plot/tensorboard_eval.py
scalar_logging
staticmethod
#
Prepare a scalar value for logging.
PARAMETER | DESCRIPTION |
---|---|
value |
The scalar value to be logged.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Tuple
|
A tuple containing the logging mode and the value for logging. The tuple format is (logging_mode, value). |