MultiheadForecastLSTM
- class neuralhydrology.modelzoo.multihead_forecast_lstm.MultiHeadForecastLSTM(cfg: Config)
Bases:
BaseModel
A forecasting model that does not roll out over the forecast horizon.
This is a forecasting model that runs a sequential (LSTM) model up to the forecast issue time, and then directly predicts a sequence of forecast timesteps without using a recurrent rollout. Prediction is done with a custom
FC
(fully connected) layer, which can include depth.Do not use this model with
forecast_overlap
> 0.- Parameters:
cfg (Config) – The run configuration.
- Raises:
ValueError if forecast_overlap > 0. –
ValueError if a forecast_network is not specified. –
- forward(data: Dict[str, Tensor]) Dict[str, Tensor]
Perform a forward pass on the MultiheadForecastLSTM model.
- Parameters:
data (Dict[str, torch.Tensor]) – Dictionary, containing input features as key-value pairs.
- Returns:
- Model outputs and intermediate states as a dictionary.
lstm_output_hindcast: Output sequence from the hindcast LSTM.
output_forecast: Predictions (before head layer) from the forecast period.
h_n_hindcast: Final hidden state of the hindcast model.
c_n_hindcast: Final cell state of the hindcast model.
y_hat: Predictions over the sequence from the head layer.
- Return type:
Dict[str, torch.Tensor]
- module_parts = ['forecast_mebedding_net', 'hindcast_embedding_net', 'hindcast_lstm', 'forecast_network', 'hindcast_head', 'forecast_head']