I-Transformer Model.
- class flood_forecast.transformer_xl.itransformer.ITransformer(forecast_history, forecast_length, d_model, embed, dropout, n_heads=8, use_norm=True, e_layers=3, d_ff=512, freq='h', activation='gelu', factor=1, output_attention=True, targs=1)[source]
Paper link: https://arxiv.org/abs/2310.06625.
- __init__(forecast_history, forecast_length, d_model, embed, dropout, n_heads=8, use_norm=True, e_layers=3, d_ff=512, freq='h', activation='gelu', factor=1, output_attention=True, targs=1)[source]
The complete iTransformer model.
- Parameters:
forecast_history (int) – The number of historical steps to use for forecasting
forecast_length (int) – The length of the forecast the model outputs.
d_model (int) – The embedding dimension of the model. For the paper the authors used 512.
embed (str) – THe embedding type to use. For the paper the authors used ‘fixed’.
dropout (float) – The dropout for the model.
n_heads (int, optional) – Number of heads for the attention, defaults to 8
use_norm (bool, optional) – Whether to use normalization, defaults to True
e_layers (int, optional) – The number of embedding layers, defaults to 3
d_ff (int, optional) – _description_, defaults to 512
freq (str, optional) – The frequency of the time series data, defaults to ‘h’ for hourly
activation (str, optional) – The activation, defaults to ‘gelu’
factor (int, optional) – =n_, defaults to 1
output_attention (bool, optional) – Whether to output the scores, defaults to True
- forecast(x_enc, x_mark_enc, x_dec, x_mark_dec)[source]
_summary_
- Parameters:
x_enc (_type_) – _description_
x_mark_enc (_type_) – _description_
x_dec (_type_) – _description_
x_mark_dec (_type_) – _description_
- Returns:
_description_
- Return type:
_type_
- forward(x_enc, x_mark_enc, x_dec, x_mark_dec, mask=None)[source]
_summary_
- Parameters:
x_enc (_type_) – _description_
x_mark_enc (_type_) – _description_
x_dec (_type_) – _description_
x_mark_dec (_type_) – _description_
mask (_type_, optional) – _description_, defaults to None
- Returns:
_description_
- Return type:
_type_