dynadojo.systems.ctln.CTLNSystem#

class dynadojo.systems.ctln.CTLNSystem#

Bases: AbstractSystem

Methods

__init__([latent_dim, embed_dim, p, seed])

param latent_dim:

dimension of the latent space

calc_control_cost(control)

Calculate the control cost for each control trajectory (i.e., calculates the costs for every control matrix, not for the whole tensor).

calc_error(x, y)

Calculates the error between two tensors of trajectories.

make_data(init_conds, control, timesteps[, ...])

Makes trajectories from initial conditions.

make_init_conds(n[, in_dist])

Generate initial conditions..

Attributes

embed_dim

The embedded dimension for the system.

latent_dim

The latent dimension for the system.

seed

The random seed for the system.

__init__(latent_dim=2, embed_dim=2, p=0.2, seed=None)#
Parameters:
  • latent_dim – dimension of the latent space

  • embed_dim – dimension of the embedding space

  • p – probability of an edge in the graph (more edges = more complex dynamics)

  • seed – random seed

calc_control_cost(control)#

Calculate the control cost for each control trajectory (i.e., calculates the costs for every control matrix, not for the whole tensor).

Parameters:

control (numpy.ndarray) – (n, timesteps, embed_dim) Controls tensor.

Returns:

(n,) Control costs vector.

Return type:

numpy.ndarray

calc_error(x, y)#

Calculates the error between two tensors of trajectories.

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

  • y (numpy.ndarray) – (n, timesteps, embed_dim) Trajectories tensor.

Returns:

The error between x and y.

Return type:

float

property embed_dim#

The embedded dimension for the system.

property latent_dim#

The latent dimension for the system.

make_data(init_conds, control, timesteps, noisy=False)#

Makes trajectories from initial conditions.

Parameters:
  • init_conds (numpy.ndarray) – (n, embed_dim) Initial conditions matrix.

  • control (numpy.ndarray) – (n, timesteps, embed_dim) Controls tensor.

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

  • noisy (bool, optional) – If True, add noise to trajectories. Defaults to False. If False, no noise is added.

Returns:

(n, timesteps, embed_dim) Trajectories tensor.

Return type:

numpy.ndarray

make_init_conds(n, in_dist=True)#

Generate initial conditions..

Note

Systems developers determine what counts as in vs out-of-distribution. DynaDojo doesn’t provide any verification that this distinction makes sense or even exists. See LDSystem for a principled example.

Parameters:
  • n (int) – Number of initial conditions.

  • in_dist (bool, optional) – If True, generate in-distribution initial conditions. Defaults to True. If False, generate out-of-distribution initial conditions.

Returns:

(n, embed_dim) Initial conditions matrix.

Return type:

numpy.ndarray

property seed#

The random seed for the system.