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.

BiTCN

chronax.models.bitcn_model.BiTCN · inherits BaseForecaster

Univariate BiTCN forecaster (JAX/Flax-NNX port of neuralforecast.BiTCN).

Maintenance status: Active univariate forecaster. Integrates with the BaseForecaster interface, including conformal prediction intervals via predict(level=...), pickle round-trip, and forecast(fitted=True).

Bidirectional Temporal Convolutional Network (Sprangers, Schelter & de Rijke, 2023). For the univariate, no-exogenous case only the backward dilated TCN is used: the lookback window is projected to hidden_size, passed through ceil(log2(input_size)) dilated causal-conv cells (kernel_size=2, dilation 2**i) accumulating a residual state and a skip signal, then two temporal dense layers map to the horizon and a final linear projects to one channel. NF default scaler_type="identity" is mirrored (trained in raw scale) with Optax adam and a pluggable point loss. float32 throughout.

Attributes: * uses_exog: False * alias: str * conformal_params: ConformalIntervals | None * model_: BiTCNNet | None

__init__(self, h, input_size=-1, hidden_size=16, dropout=0.5, use_boxcox=False, max_steps=1000, learning_rate=1e-3, windows_batch_size=1024, random_seed=1, alias='BiTCN', loss='mae')

Initialize a BiTCN forecaster. Stores hyperparameters; the network is built lazily at fit time.

Parameter Type Default Description
h int - (undocumented)
input_size int -1 Resolves to 3 * h if less than 1.
hidden_size int 16 (undocumented)
dropout float 0.5 (undocumented)
use_boxcox bool False Applies a variance-stabilizing Box-Cox transform before modelling and inverts it on the forecast, mirroring :class:chronax.models.TBATS. It requires strictly positive values.
max_steps int 1000 (undocumented)
learning_rate Union[float, Callable[[int], float]] 1e-3 A scalar or an optax.ScalarOrSchedule. If the fitted estimator will be pickled, any callable passed must itself be picklable.
windows_batch_size int 1024 (undocumented)
random_seed int 1 (undocumented)
alias str "BiTCN" (undocumented)
loss Union[str, LossFn] "mae" A registry name ("mae"/"mse"/"huber") or a callable. If the fitted estimator will be pickled, any callable passed must itself be picklable.

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

Fit the network on a 1-D series of length >= input_size + h.

Parameters:

Parameter Type Default Description
y jnp.ndarray - (undocumented)
X jnp.ndarray | None None (undocumented)

Returns: Self (the fitted forecaster; sets self.model_). Raises: * NotImplementedError: If exogenous variables (X) are provided. * ValueError: If y is not 1-D or is too short. * ValueError: If use_boxcox=True requires strictly positive series values but y contains non-positive values.

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

Forecast h steps (1 <= h <= self.h) from the fitted context.

Parameters:

Parameter Type Default Description
h int - (undocumented)
X jnp.ndarray | None None (undocumented)
level list[int | float] | None None (undocumented)

Returns: dict Keys: {"mean": jnp.ndarray}. If level is provided, includes prediction interval keys (e.g., "lower_90", "upper_90"). Raises: * RuntimeError: If fit(y) has not been called. * ValueError: If h is not positive or if h exceeds self.h. * ValueError: If level is provided but model.conformal_params is not set.

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

Stateless fit-then-predict on y. Optionally add "fitted".

Parameters:

Parameter Type Default Description
y jnp.ndarray - (undocumented)
h int - (undocumented)
X jnp.ndarray | None None (undocumented)
X_future jnp.ndarray | None None (undocumented)
level list[int | float] | None None (undocumented)
fitted bool False (undocumented)

Returns: dict Keys: {"mean": jnp.ndarray}. If level is provided, includes prediction interval keys. If fitted=True, includes "fitted": jnp.ndarray (One-step-ahead fitted values). Raises: * NotImplementedError: If exogenous variables (X or X_future) are provided.