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.

pad_sequence

chronax.data.pad_sequence

Left-pad / left-truncate a 1D series to target_len.

The mask is 1 on real observations and 0 on the padded prefix, matching available_mask semantics.

pad_sequence(y, target_len, pad_value=0.0)

Parameter Type Default Description
y jnp.ndarray - (undocumented)
target_len int - (undocumented)
pad_value float 0.0 (undocumented)

Returns: Tuple[jnp.ndarray, jnp.ndarray]

align_covariates

chronax.data.align_covariates

Align per-series exogenous arrays to model expectations.

hist_exog is left-padded to length input_size. futr_exog must cover both history and the forecast horizon, so it is left-padded to input_size + h. stat_exog is returned as-is (cast to float32).

align_covariates(hist_exog, futr_exog, stat_exog, input_size, h)

Parameter Type Default Description
hist_exog Optional[jnp.ndarray] - (undocumented)
futr_exog Optional[jnp.ndarray] - (undocumented)
stat_exog Optional[jnp.ndarray] - (undocumented)
input_size int - (undocumented)
h int - (undocumented)

Returns: Dict[str, Optional[jnp.ndarray]]

create_batch

chronax.data.create_batch

Build a single JAX batch from a list of complete time series.

Every series is split into (history, horizon); the history is padded/truncated to input_size (yielding available_mask) and the horizon is padded/truncated to h (yielding sample_mask, optionally AND-ed with the user-supplied per-series mask).

create_batch(y_series, input_size, h, hist_exog_list=None, futr_exog_list=None, stat_exog_list=None, sample_mask_list=None)

Parameter Type Default Description
y_series List[jnp.ndarray] - list of 1D series, each of length T_i (the model uses the last h of each as the outsample target).
input_size int - history window length L.
h int - forecast horizon.
hist_exog_list Optional[List[Optional[jnp.ndarray]]] None per-series [T_i, X] historic exog, or None.
futr_exog_list Optional[List[Optional[jnp.ndarray]]] None per-series [T_i + h, F] future exog, or None.
stat_exog_list Optional[List[Optional[jnp.ndarray]]] None per-series [S] static exog, or None.
sample_mask_list Optional[List[Optional[jnp.ndarray]]] None per-series [h] (or compatible) horizon masks, or None for "all ones".

Returns: Dict[str, Optional[jnp.ndarray]] (Dict with JAX arrays:) * insample_y [B, L, 1] * outsample_y [B, h, 1] * available_mask[B, L, 1] 1=real history, 0=padded * sample_mask [B, h, 1] 1=loss applies, 0=ignore * hist_exog [B, L, X] or None * futr_exog [B, L+h, F] or None * stat_exog [B, S] or None

batch_generator

chronax.data.batch_generator

Iterate over y_series yielding fully-prepared JAX batches.

Side-effect-free: uses a local jax.random key so calls with the same seed produce identical batch order.

batch_generator(y_series, input_size, h, batch_size, hist_exog_list=None, futr_exog_list=None, stat_exog_list=None, sample_mask_list=None, shuffle=True, seed=42)

Parameter Type Default Description
y_series List[jnp.ndarray] - (undocumented)
input_size int - (undocumented)
h int - (undocumented)
batch_size int - (undocumented)
hist_exog_list Optional[List[Optional[jnp.ndarray]]] None (undocumented)
futr_exog_list Optional[List[Optional[jnp.ndarray]]] None (undocumented)
stat_exog_list Optional[List[Optional[jnp.ndarray]]] None (undocumented)
sample_mask_list Optional[List[Optional[jnp.ndarray]]] None (undocumented)
shuffle bool True (undocumented)
seed int 42 (undocumented)

Returns: Iterator[Dict[str, Optional[jnp.ndarray]]]