dynadojo.systems.lv.competitive.CompetitiveLVSystem#
- class dynadojo.systems.lv.competitive.CompetitiveLVSystem#
- Bases: - AbstractSystem- Methods - __init__([latent_dim, embed_dim, minK, ...])- Initialize the class. - 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 - The embedded dimension for the system. - The latent dimension for the system. - The random seed for the system. - __init__(latent_dim=2, embed_dim=2, minK=1, maxK=10, noise_scale=0.01, IND_range=(0.1, 0.5), OOD_range=(0.5, 0.9), R_range=(0.0, 0.5), interspecies_range=(0, 1), seed=None)#
- Initialize the class. - Parameters:
- latent_dim (int) – Dimension of the latent space. 
- embed_dim (int) – Embedded dimension of the system. 
- seed (int or None, optional) – Seed for random number generation. 
- **kwargs – Additional keyword arguments. 
 
 
 - 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 - LDSystemfor 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.