shredx.modules.rnn.MOEGRUEncoder#
- class shredx.modules.rnn.MOEGRUEncoder(input_size: int, hidden_size: int, n_experts: int, forecast_length: int, strict_symmetry: bool, num_layers: int, dropout: float, device: str = 'cpu', **kwargs)#
Bases:
Module,MOESINDyLayerHelpersMixinMixture of Experts GRU with SINDy layer forecasting.
Combines a GRU encoder with multiple SINDy expert layers for long-horizon forecasting. Expert outputs are combined via learned weighted averaging.
- Parameters:
- input_sizeint
Input feature dimension.
- hidden_sizeint
Hidden state dimension for GRU and experts.
- n_expertsint
Number of SINDy expert layers.
- forecast_lengthint
Number of timesteps to forecast.
- strict_symmetrybool
If True, enforce symmetric SINDy coefficients.
- num_layersint
Number of GRU layers.
- dropoutfloat
Dropout probability for expert weighting.
- devicestr, optional
Device on which to place the module. Default is
"cpu".- **kwargs
Additional keyword arguments (ignored).
Methods
forward(x)Forward pass through the MOE-GRU model.
Notes
Class Methods:
forward(x):
Processes input through the GRU, then passes the final hidden state through all SINDy experts and combines their outputs.
- Parameters:
x :
Float[torch.Tensor, "batch sequence input_size"]. Input tensor.
- Returns:
tuple. Tuple containing the final output tensor of shape
(batch_size, forecast_length, 1, hidden_size)andNonefor no auxiliary losses.