Ambric.fit()

Fit the ambric model.

Usage

Ambric.fit(
    n_model_fit_iterations=200000,
    n_posterior_samples=3000,
    xgb_params=None,
    bridge_use_almon=True,
    bridge_ridge_alpha=1.0,
    advi_log_every=None,
    advi_convergence_tolerance=1.0
)

Pipeline

  1. Extract factors from regional indicator panel.
  2. Train XGBoost on annually-aggregated raw indicators to predict annual regional growth. Years with an outturn are predicted leave-one-year-out.
  3. Fit MIDAS bridge equation, on those out-of-fold predictions, to disaggregate XGBoost annual predictions to quarterly frequency.
  4. Build Bayesian state-space model with factors, macro, and bridge signal.
  5. Run variational inference.

Parameters

n_model_fit_iterations: int = 200000

Number of ADVI iterations.

n_posterior_samples: int = 3000

Number of posterior samples to draw.

xgb_params: dict | None = None

Optional XGBoost hyperparameters override.

bridge_use_almon: bool = True

Use Almon polynomial for MIDAS weights.

bridge_ridge_alpha: float = 1.0

Ridge regularisation for bridge equation.

advi_log_every: int | None = None

Iterations between log lines reporting the ADVI loss. Defaults to one twentieth of the run.

advi_convergence_tolerance: float = 1.0

Largest fall in mean loss, in nats, between the last two 5% windows of the run that still counts as converged. A warning is logged when the fit is still improving by more than this.

Returns

Ambric

Self for method chaining.