sega_learn.neural_networks.animation

 
Classes
       
builtins.object
TrainingAnimator

 
class TrainingAnimator(builtins.object)
    TrainingAnimator(figure_size=(18, 10), dpi=100)
 
A utility class to create and manage training animations.
 
This class provides callback functions that can be used during model training.
 
  Methods defined here:
__init__(self, figure_size=(18, 10), dpi=100)
Initialize the animator with given figure size and DPI.
 
Args:
    figure_size: (tuple) - Size of the figure (width, height)
    dpi: (int) - DPI for rendering
add_training_frame(self)
Add a frame to the training video.
animate_training_metrics(self, interval=200, blit=True, save_path=None, save_format='mp4', fps=10, dpi=300)
Create an animation of the training metrics.
 
Args:
    interval: (int) - Delay between frames in milliseconds
    blit: (bool) - Whether to use blitting for efficient animation
    save_path: (str - optional): Path to save the animation
    save_format: (str) - Format to save animation ('mp4', 'gif', etc.)
    fps: (int) - Frames per second for the saved video
    dpi: (int) - DPI for the saved animation
 
Returns:
    animation.FuncAnimation: Animation object
finish_training_video(self, print_message=True)
Finish and save the training video.
initialize(self, metrics_to_track, has_validation=False)
Initialize the animation with specified metrics.
 
Args:
    metrics_to_track: (list) - List of metrics to track
    has_validation: (bool) - Whether validation metrics are available
setup_training_video(self, filepath, fps=10, dpi=None)
Set up a video writer to capture training progress in real-time.
 
Args:
    filepath: (str) - Path to save the video
    fps: (int) - Frames per second
    dpi: (int, optional) - DPI for rendering
update_metrics(self, epoch_metrics, validation=False)
Update the stored metrics with new values.
 
Args:
    epoch_metrics (dict): Dictionary containing metric values
    validation (bool): Whether these are validation metrics

Data descriptors defined here:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object