Utils#

navground.learning.utils

Plotting#

navground.learning.utils.plot

Parameters:
Return type:

None

Bases: NamedTuple

Parameters:

Plots logged fields.

Parameters:
  • logs (DataFrame) – The logs

  • key (str) – Common x-axis key

  • fields (Sequence[LogField]) – Which fields to plot.

  • two_axis (bool) – Whether to use two axis (only if there are two fields)

  • title (str)

  • kwargs (Any)

Return type:

None

StableBaseLine3#

navground.learning.utils.sb3

Bases: BaseCallback

Exports the (best) model policy as “best_policy.onnx”.

Parameters:

name_fn (Callable[[BaseCallback], str])

Bases: BaseCallback

Similar to SB3’s own stable_baselines3.common.callbacks.ProgressBarCallback, it displays a progress bar when training SB3 agent using tqdm but includes episodes mean reward and length.

Parameters:

every (int)

Bases: BaseCallback

A SB3 callback that makes a video of one or more runs of an environment.

Parameters:

Loads the evaluation logs from a csv.

Parameters:

path (PathLike) – The directory with csv logs

Returns:

A dataframe with the logs

Return type:

DataFrame

Plots reward, success and/or length from the eval logs

Parameters:
  • path (PathLike) – The directory with csv logs

  • reward (bool) – Whether to plot the reward

  • reward_color (str) – The reward color

  • reward_linestyle (str) – The reward linestyle

  • success (bool) – Whether to plot the success

  • length (bool) – Whether to plot the length

  • reward_low (float | None) – An optional lower bound to scale the reward

  • reward_high (float) – An optional upper bound to scale the reward

  • lenght_low – An optional lower bound to scale the reward

  • lenght_high – An optional upper bound to scale the reward

  • two_axis (bool) – Whether to use two axis (only if there are two fields)

  • length_low (float)

  • length_high (float | None)

  • kwargs (Any)

Return type:

None

BenchMARL#

navground.learning.utils.benchmarl