Informer
chronax.models.informer_model.Informer · inherits BaseForecaster
Informer: ProbSparse-attention transformer for long-sequence forecasting (flax.nnx port of neuralforecast.Informer). Zhou et al., 2021 (AAAI best paper) -- https://arxiv.org/abs/2012.07436. The encoder is a distilling stack of ProbSparse self-attention layers -- each layer pair is followed by a conv+maxpool step that halves the sequence length, giving O(L log L) memory/time instead of full attention's O(L^2) -- and the decoder is "generative": it consumes the last label_len observed steps followed by h zero placeholders and produces the whole horizon in a single forward pass (no autoregressive loop). Future-known exogenous inputs are supported (uses_exog = True); historical and static exog are not modeled. Point or multi-quantile losses; conformal or native quantile intervals. float32 throughout.
Attributes:
* uses_exog: True
* alias: Informer
* conformal_params: ConformalIntervals | None
* model_: InformerNet | None
__init__(self, h, input_size=-1, decoder_input_size_multiplier=0.5, hidden_size=128, n_head=4, factor=3, conv_hidden_size=32, encoder_layers=2, decoder_layers=1, distil=True, dropout=0.05, activation='gelu', max_steps=5000, learning_rate=1e-4, windows_batch_size=1024, scaler_type='identity', loss='mae', quantile_sort=True, random_seed=1, alias='Informer')
(No prose summary available)
| Parameter | Type | Default | Description |
|---|---|---|---|
h |
- | - | (undocumented) |
input_size |
- | -1 |
(undocumented) |
decoder_input_size_multiplier |
- | 0.5 |
(undocumented) |
hidden_size |
- | 128 |
(undocumented) |
n_head |
- | 4 |
(undocumented) |
factor |
- | 3 |
(undocumented) |
conv_hidden_size |
- | 32 |
(undocumented) |
encoder_layers |
- | 2 |
(undocumented) |
decoder_layers |
- | 1 |
(undocumented) |
distil |
- | True |
(undocumented) |
dropout |
- | 0.05 |
(undocumented) |
activation |
- | "gelu" |
(undocumented) |
max_steps |
- | 5000 |
(undocumented) |
learning_rate |
- | 1e-4 |
(undocumented) |
windows_batch_size |
- | 1024 |
(undocumented) |
scaler_type |
- | "identity" |
(undocumented) |
loss |
- | "mae" |
(undocumented) |
quantile_sort |
- | True |
(undocumented) |
random_seed |
- | 1 |
(undocumented) |
alias |
- | "Informer" |
(undocumented) |
fit(self, y, X=None, *, futr_exog=None) -> Self
(No prose summary available)
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
y |
- | - | (undocumented) |
X |
- | None |
(undocumented) |
futr_exog |
- | None |
(undocumented) |
Returns: Self (the fitted forecaster; sets self.model_).
Raises:
* NotImplementedError: If X is provided.
* ValueError: If y is not 1-D, if series length is too short, or if futr_exog length does not align with y.
predict(self, h, X=None, *, futr_exog=None, level=None) -> dict
(No prose summary available)
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
h |
- | - | (undocumented) |
X |
- | None |
(undocumented) |
futr_exog |
- | None |
(undocumented) |
level |
- | None |
(undocumented) |
Returns: dict. Keys include:
* "mean": jnp.ndarray (Point forecast or median if quantile loss).
* "lo-L": jnp.ndarray (Lower bound of confidence/prediction interval for level L, if level is provided).
* "hi-L": jnp.ndarray (Upper bound of confidence/prediction interval for level L, if level is provided).
Raises:
* RuntimeError: If fit() has not been called.
* ValueError: If h is not a positive integer or exceeds the trained horizon self.h.
* ValueError: If future-known exog was used during training but futr_exog is missing or has the wrong shape during prediction.
* ValueError: If conformal intervals are requested (level is set) but temporal exog was used.
* ValueError: If conformal intervals are requested but self.conformal_params is None.
* ValueError: If requested quantile level was not trained.
forecast(self, y, h, X=None, X_future=None, *, futr_exog=None, level=None, fitted=False) -> dict
Stateless fit-then-predict. X is unsupported (Informer models future-known exog only); X_future = future-known exog for the horizon (h, F); futr_exog = its history (T, F).
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
y |
- | - | (undocumented) |
h |
- | - | (undocumented) |
X |
- | None |
(undocumented) |
X_future |
- | None |
(undocumented) |
futr_exog |
- | None |
(undocumented) |
level |
- | None |
(undocumented) |
fitted |
- | False |
(undocumented) |
Returns: dict. Keys include prediction results (as per predict). If fitted=True, also includes "fitted": jnp.ndarray.