dymad.models.recipes_corr¶
Functions
|
Encodes states. |
|
Encodes states and controls. |
Classes
|
Template class for dynamics modeling with algebraic corrections. |
|
Template class for dynamics modeling with differential corrections. |
- class dymad.models.recipes_corr.TemplateCorrAlg(model_config, data_meta, dtype=None, device=None)¶
Bases:
ComposedDynamicsTemplate class for dynamics modeling with algebraic corrections. Consider a base dynamics model with parameters p
x’ = Base_Dynamics(x, u, p)
The corrected dynamics model with residual force f is given by
f = Residual_Force(x, u)
x’ = Base_Dynamics_With_Correction(x, u, f, p)
Here the user needs to provide Base_Dynamics_With_Correction that takes the residual force as an additional input.
- CONT = None¶
- GRAPH = False¶
- base_dynamics(x, u, f, p)¶
The minimal that the user must implement.
f is the residual correction term computed by self.dynamics.net, and needs to be incorporated into the base dynamics.
- Return type:
Tensor
- dynamics(z, w)¶
Processing without control inputs.
- Return type:
Tensor
- extra_setup()¶
Additional setup in derived classes. Called at end of __init__.
- class dymad.models.recipes_corr.TemplateCorrDif(model_config, data_meta, dtype=None, device=None)¶
Bases:
ComposedDynamicsTemplate class for dynamics modeling with differential corrections. Consider a base dynamics model with parameters p
x’ = Base_Dynamics(x, u, p)
Add a latent dynamics state s for correction
s’ = Latent_Dynamics(x, s, u)
f = Residual_Force(x, s, u)
Then full dynamics is
z = [x, Encoder(x,u)]
x’ = Base_Dynamics_With_Correction(x, u, f, p)
s’ = Latent_Dynamics(z=[x, s], u)
f = Residual_Force(z=[x, s], u)
x_hat = Decoder(z=[x, s])
Here the user needs to provide Base_Dynamics_With_Correction that takes the residual force as an additional input.
Due to the special structure, the autoencoder dimensions are fixed,
Encoder input: n_total_features (x or x+u)
Encoder output: latent_dimension (s)
Decoder input: n_total_state_features + latent_dimension (x+s)
Decoder output: n_total_state_features (x)
- CONT = None¶
- GRAPH = False¶
- base_dynamics(x, u, f, p)¶
The minimal that the user must implement.
f is the residual correction term as output from the latent dynamics, and needs to be incorporated into the base dynamics.
- Return type:
Tensor
- diagnostic_info()¶
Return diagnostic information about the model.
- Returns:
String with model details
- Return type:
str
- dynamics(z, w)¶
Compute the dynamics output given latent states and inputs.
Note this uses three components: features, processor, and composer.
- Return type:
Tensor
- extra_setup()¶
Additional setup in derived classes. Called at end of __init__.
- dymad.models.recipes_corr.enc_corr_dif_auto(self, w)¶
Encodes states.
- Return type:
Tensor
- dymad.models.recipes_corr.enc_corr_dif_ctrl(self, w)¶
Encodes states and controls.
- Return type:
Tensor