Observers#
smart_control.reinforcement_learning.observers.base_observer
#
Base observer interface for all RL observers.
This module defines the Observer abstract class that all RL observers should implement.
Observer
#
Bases: ABC
Abstract base class for all observers.
Observers are objects that monitor the training process, collect metrics, and visualize the agent's behavior. They are called with trajectories during data collection.
reset
abstractmethod
#
Reset the observer to its initial state.
This method is called when a new episode starts.
smart_control.reinforcement_learning.observers.print_status_observer
#
Reinforcement learning print status observer.
PrintStatusObserver
#
smart_control.reinforcement_learning.observers.rendering_observer
#
Observer for rendering and visualizing environments.
This module provides an observer for rendering RL environments and visualizing agent behavior through plots.
RenderingObserver
#
RenderingObserver(
render_interval_steps: int = 10,
env=None,
render_fn: Optional[Callable] = None,
plot_fn: Optional[Callable] = None,
clear_output_before_render: bool = True,
time_zone: str = DEFAULT_TIME_ZONE,
save_path: str = RENDERS_PATH,
)
Bases: Observer
Observer that renders the environment and plots metrics.
This observer renders the environment at specified intervals and can also show plots of metrics.
Initialize the observer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
render_interval_steps
|
int
|
Number of steps between renders. |
10
|
env
|
The environment to render. This must support the current_simulation_timestamp property if plot_fn is specified. |
None
|
|
render_fn
|
Optional[Callable]
|
Optional function to use for rendering. If not provided, environment.render() will be used. |
None
|
plot_fn
|
Optional[Callable]
|
Optional function to use for plotting. If not provided, no plotting will be done. |
None
|
clear_output_before_render
|
bool
|
Whether to clear output before rendering. |
True
|
time_zone
|
str
|
Time zone for plotting timestamps. |
DEFAULT_TIME_ZONE
|
save_path
|
str
|
Directory path to save rendered visualizations. |
RENDERS_PATH
|
smart_control.reinforcement_learning.observers.composite_observer
#
Reinforcement learning composite observer.
CompositeObserver
#
Bases: Observer
Observer that combines multiple observers.
This observer calls all of its constituent observers whenever it is called. It provides a convenient way to use multiple observers together.
Initialize the observer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
observers
|
Sequence[Observer]
|
A sequence of observers to combine. |
required |