gru – Gated recurrent unit RNN (torch, optional).#
Back to family axis | Back to L4 | Browse all options
Operational op under axis
family, sub-layerL4_A_model_selection, layerl4. Standalone callable:mf.functions.gru_fit.
Function signature#
mf.functions.gru_fit(
X: np.ndarray | pd.DataFrame,
y: np.ndarray | pd.Series,
) -> GRUFitResult
Parameters#
name |
type |
default |
constraint |
description |
|---|---|---|---|---|
|
`np.ndarray |
pd.DataFrame` |
— |
— |
|
`np.ndarray |
pd.Series` |
— |
— |
Returns#
GRUFitResult — frozen dataclass with fit results.
Attribute |
Type |
Description |
|---|---|---|
|
|
Total number of trainable parameters in GRU + head. |
|
|
Number of input features seen during fit. |
|
|
Width of the GRU hidden state. |
|
|
Number of training epochs completed. |
|
|
Training MSE via no-grad forward pass after fitting. |
|
|
Predictions for new data X, shape (n_samples,). |
|
|
Arch metadata table: model_type, hidden_size, n_features, n_params, epochs_used, final_loss. |
Behavior#
Requires pip install macroforecast[deep]. Simpler than LSTM (one fewer gate); often comparable on macro panels.
When to use
Sequence-modelling baselines; LSTM ablations.
When NOT to use
Without [deep] installed.
In recipe context#
Set params.family = "gru" in the relevant layer to activate this op within a recipe:
# Layer L4 recipe fragment
params:
family: gru
References#
macroforecast design Part 2, L4: ‘forecasting model is the layer where every authoring iteration ends – pick family, tune, repeat.’
Cho et al. (2014) ‘Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation’, EMNLP.