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.

DeepAR_EncDec

chronax.model.DeepAR_EncDec · inherits nn.Module

(No prose description provided in class docstring.)

__init__(self, hidden=64, dropout_rate=0.1, min_sigma=0.02)

Parameter Type Default Description
hidden int 64 (undocumented)
dropout_rate float 0.1 (undocumented)
min_sigma float 0.02 (undocumented)

encode(self, y_hist, futr_exog=None, x_static=None)

(No prose summary.)

Parameter Type Default Description
y_hist - - (undocumented)
futr_exog - None (undocumented)
x_static - None (undocumented)

Returns: hT, cT

one_step(self, y_prev, x_f_step=None, x_static=None, h=None, c=None, deterministic=True)

(No prose summary.)

Parameter Type Default Description
y_prev - - (undocumented)
x_f_step - None (undocumented)
x_static - None (undocumented)
h - None (undocumented)
c - None (undocumented)
deterministic bool True (undocumented)

Returns: mu[0], sigma[0], h_new, c_new

__call__(self, y_seq, futr_exog=None, x_static=None, training=True, init_state=None)

(No prose summary.)

Parameter Type Default Description
y_seq - - (undocumented)
futr_exog - None (undocumented)
x_static - None (undocumented)
training bool True (undocumented)
init_state - None (undocumented)

Returns: mu, sigma

make_trainer

chronax.model.make_trainer

(No prose summary.)

Parameter Type Default Description
model - - (undocumented)
lr - 1e-3 (undocumented)
weight_decay - 1e-5 (undocumented)

Returns: tx, step

train_model

chronax.model.train_model

Train DeepAR with batched encode-decode and seasonal lag features.

Lag features: lag-1 (autocorr), lag-7 (weekly), lag-h (horizon), lag-2h. During training, all lags are precomputed from teacher-forced windows. During inference, lag-1/7 are tracked via a rolling buffer in the scan carry.

Parameter Type Default Description
y_hist jnp.ndarray - (undocumented)
x_f_all jnp.ndarray None (undocumented)
x_static jnp.ndarray None (undocumented)
hidden int 64 (undocumented)
lr float 1e-3 (undocumented)
steps int 800 (undocumented)
dropout float 0.1 (undocumented)
min_sigma float 0.02 (undocumented)
h int 24 (undocumented)
batch_size int 32 (undocumented)
verbose bool True (undocumented)

Returns: (model, params, losses, scaler) where scaler = (mean, std).

forecast_mc

chronax.model.forecast_mc

Monte Carlo forecast. Returns sample paths [N, H].

Lag-1/7 are tracked via a rolling buffer in the scan carry so predicted values are correctly used as lags in later decode steps.

Parameter Type Default Description
params - - (undocumented)
model DeepAR_EncDec - (undocumented)
y_hist jnp.ndarray - (undocumented)
x_f_hist jnp.ndarray None (undocumented)
x_f_future jnp.ndarray None (undocumented)
x_static jnp.ndarray None (undocumented)
H int 24 (undocumented)
N int 1000 (undocumented)
seed int 2025 (undocumented)
scaler - None (undocumented)
input_size int None (undocumented)

Returns: jnp.ndarray (sample paths [N, H]).

quantiles

chronax.model.quantiles

(No prose summary.)

Parameter Type Default Description
paths jnp.ndarray - (undocumented)
qs - (0.1, 0.5, 0.9) (undocumented)

Returns: list of jnp.ndarray