Esc
Ask AIAnswers may be inaccurate; check the linked pages.Esc
Ask anything about these docs, like how to get started or what a function does.

TCN

chronax.models.tcn_model.TCN · inherits BaseForecaster

TCN: Temporal Convolution Network with MLP decoder (flax.nnx port of neuralforecast.TCN). Lea et al., 2016 -- https://arxiv.org/abs/1608.08242. The historical encoder is a stack of dilated causal 1-D convolutions (exponentially increasing dilations give an exponentially large receptive field), a context adapter Linear(input_size -> h) maps the encoded history onto the forecasting window in a single pass (no autoregressive loop), and a per-timestep MLP decodes each horizon step. Future-known exogenous inputs are supported (uses_exog = True): their history joins the encoder channels and their horizon slice is residual-concatenated before the decoder. Historical and static exog are not modeled. context_size is accepted for neuralforecast API parity but is unused. Point or multi-quantile losses; conformal or native quantile intervals. float32 throughout.

Attributes: * uses_exog: True * alias: "TCN" * conformal_params: ConformalIntervals | None * model_: TCNNet | None

__init__(self, h, input_size=-1, kernel_size=2, dilations=None, encoder_hidden_size=128, encoder_activation='ReLU', context_size=10, decoder_hidden_size=128, decoder_layers=2, max_steps=1000, learning_rate=1e-3, windows_batch_size=128, scaler_type='robust', loss='mae', quantile_sort=True, random_seed=1, alias='TCN')

Parameter Type Default Description
h - - (undocumented)
input_size - -1 (undocumented)
kernel_size - 2 (undocumented)
dilations - None (undocumented)
encoder_hidden_size - 128 (undocumented)
encoder_activation - "ReLU" (undocumented)
context_size - 10 accepted for API parity; unused
decoder_hidden_size - 128 (undocumented)
decoder_layers - 2 (undocumented)
max_steps - 1000 (undocumented)
learning_rate - 1e-3 (undocumented)
windows_batch_size - 128 (undocumented)
scaler_type - "robust" (undocumented)
loss - "mae" (undocumented)
quantile_sort - True (undocumented)
random_seed - 1 (undocumented)
alias - "TCN" (undocumented)

fit(self, y, X=None, *, futr_exog=None) -> Self

Parameter Type Default Description
y - - (undocumented)
X - None (undocumented)
futr_exog - None (undocumented)

Returns: Self (the fitted forecaster; sets self.model_). Raises: NotImplementedError, ValueError.

predict(self, h, X=None, *, futr_exog=None, level=None) -> dict

Parameter Type Default Description
h - - (undocumented)
X - None (undocumented)
futr_exog - None (undocumented)
level - None (undocumented)

Returns: dict. Keys include "mean" (jnp.ndarray). If level is provided, keys may include prediction intervals (e.g., "lo-90", "hi-90") either via native quantiles or conformal prediction. Raises: RuntimeError, ValueError.

forecast(self, y, h, X=None, X_future=None, *, futr_exog=None, level=None, fitted=False) -> dict

Stateless fit-then-predict. X is unsupported (TCN models future-known exog only); X_future = future-known exog for the horizon (h, F); futr_exog = its history (T, F).

Parameter Type Default Description
y - - (undocumented)
h - - (undocumented)
X - None X is unsupported (TCN models future-known exog only)
X_future - None future-known exog for the horizon (h, F)
futr_exog - None its history (T, F)
level - None (undocumented)
fitted - False (undocumented)

Returns: dict. Includes prediction keys (mean/quantiles/intervals) and optionally "fitted" (jnp.ndarray) if fitted=True. Raises: NotImplementedError (if fitted=True and temporal exog is present).