dynadojo.baselines.aug_ode.AugODE#

class dynadojo.baselines.aug_ode.AugODE#

Bases: AbstractAlgorithm

Methods

__init__(embed_dim, timesteps, max_control_cost)

Initialize the class.

act(x, **kwargs)

Determines the control for each action horizon.

fit(x[, epochs])

Fits the algorithm on a tensor of trajectories.

forward(t, state)

predict(x0, timesteps)

Predict how initial conditions matrix evolves over a given number of timesteps.

Attributes

embed_dim

The embedded dimension of the dynamics.

max_control_cost

The maximum control cost.

seed

The random seed for the algorithm.

timesteps

The timesteps per training trajectory.

__init__(embed_dim, timesteps, max_control_cost, lr=0.03, aug_dim=2, **kwargs)#

Initialize the class.

Parameters:
  • embed_dim (int) – Embedded dimension of the dynamics.

  • timesteps (int) – Timesteps per training trajectory (per action horizon).

  • max_control_cost (float) – Maximum control cost per trajectory (per action horizon).

  • **kwargs – Additional keyword arguments.

Note

Timesteps refer to the timesteps of the training data, NOT the length of the predicted trajectories. The length of the predicted trajectories is specified in an argument provided in the predict() method.

act(x, **kwargs)#

Determines the control for each action horizon. control.

Parameters:
  • x (numpy.ndarray) – (n, timesteps, embed_dim) Trajectories tensor.

  • **kwargs – Additional keyword arguments.

Returns:

(n, timesteps, embed_dim) controls tensor.

Return type:

numpy.ndarray

property embed_dim#

The embedded dimension of the dynamics.

fit(x, epochs=100, **kwargs)#

Fits the algorithm on a tensor of trajectories.

Parameters:
  • x (np.ndarray) – (n, timesteps, embed_dim) Trajectories tensor.

  • **kwargs – Additional keyword arguments.

property max_control_cost#

The maximum control cost.

predict(x0, timesteps)#

Predict how initial conditions matrix evolves over a given number of timesteps.

Note

The timesteps argument can differ from the ._timesteps attribute. This allows algorithms to train on a dataset of a given size and then predict trajectories of arbitrary lengths.

Note

The first coordinate of each trajectory should match the initial condition x0.

Parameters:
  • x0 (np.ndarray) – (n, embed_dim) initial conditions matrix

  • timesteps (int) – timesteps per predicted trajectory

  • **kwargs – Additional keyword arguments.

Returns:

(n, timesteps, embed_dim) trajectories tensor

Return type:

np.ndarray

property seed#

The random seed for the algorithm.

property timesteps#

The timesteps per training trajectory.