Foundational Models#

Source Files
  • twiga/models/foundational/base.py - BaseFoundationalModel

  • twiga/models/foundational/chronos2_model.py - Chronos2Model / Chronos2Config

  • twiga/models/foundational/tabicl_model.py - TabICLModel / TabICLConfig

  • twiga/models/foundational/moirai_model.py - MoiraiModel / MoiraiConfig

  • twiga/models/foundational/timesfm_model.py - TimesFMModel / TimesFMConfig

  • twiga/models/foundational/lag_llama_model.py - LagLlamaModel / LagLlamaConfig

Twiga’s foundational domain provides pre-trained, task-agnostic models that require no training on your target data. Unlike learned models that fit parameters to your specific time series, foundational models download pre-trained weights and generate probabilistic forecasts immediately through zero-shot inference. They leverage transfer learning from training on millions of diverse time series, making them robust to domain shift and data scarcity.

Foundational models share the same TwigaForecaster interface as ML and NN models and can be composed freely with learned models for ensemble forecasting. All foundational models are inherently probabilistic (quantile-based) and generate confidence intervals and prediction intervals without requiring explicit calibration.

For the full model catalogue see the Model Catalog Overview.

When to use foundational models

Use case

Recommended model

Rapid prototyping on new domain

Chronos2Model() — validate problem in seconds, no data tuning required

Small datasets (<1000 samples)

Chronos2Model() — pre-training beats local fitting on limited data

Production with minimal latency

Chronos2Model() — inference time measured in seconds per batch

Domain transfer / few-shot learning

Chronos2Model() — leverage 2M+ diverse time series in pre-training

Probabilistic baseline or ensemble component

Chronos2Model() — 21 quantiles require no fine-tuning

Confidence estimation without calibration

Chronos2Model() — zero-shot intervals from pre-trained quantile distribution

When NOT to use foundational models:

  • Extreme latency requirements (<100ms per prediction) — inference is ~seconds per batch

  • Custom quantile levels — Chronos2 outputs 21 fixed quantiles, not arbitrary τ values

  • Multivariate forecasting — current generation is univariate only

  • Specialized domains with abundant domain-specific data — fine-tuned domain models often outperform

Common Interface#

All foundational models extend BaseQuantileRegressor and implement the quantile regression interface. They are zero-shot: no local training occurs, only weight loading and inference.

Constructor Pattern#

Model(model_config: Config | None = None)

Each model defaults to its own config class when model_config is omitted.

Shared Attributes#

Attribute

Type

Description

model

Object

Pre-trained model pipeline (e.g., Chronos2Pipeline). Loaded during fit().

num_targets

int

Always 1 — foundational models are univariate only.

horizon

int

Forecast horizon length. Set during fit() from y.shape.

quantiles

list[float]

Quantile levels produced by the model (fixed architecture).

device

str

Compute device: 'cpu', 'cuda', or 'mps' (Apple Silicon).

Shared Methods#

Method

Signature

Description

fit

fit(X, y, eval_set=None, verbose=False) -> self

Validates dimensions, loads pre-trained weights from HuggingFace or cache, sets num_targets and horizon. No parameter optimization. eval_set accepted for API compatibility.

predict

predict(x: np.ndarray) -> tuple[np.ndarray, np.ndarray]

Returns median forecast and full quantile predictions. Shape: (B, horizon, n_targets) and (B, n_quantiles, horizon, n_targets).

forecast

forecast(x: np.ndarray, sigma=False) -> dict

Returns dict with keys 'loc' (median) and 'quantiles' (all quantile predictions).

update

update(trial) -> None

Rebuilds config from Optuna trial parameters if hyperparameter tuning is enabled.

Feature-column convention

Foundational models read the target variable from the input array X. The DataPipeline convention applies: X[:, t, :num_targets] contains raw target values at time step t within the lookback window. When using custom pipelines with foundational models, ensure the first num_targets columns are the target variable(s) in chronological order.

Chronos2Model#

Chronos2Model implements zero-shot forecasting via a pre-trained 12-billion-parameter autoregressive transformer trained on 2M+ diverse time series spanning energy, traffic, weather, retail, and more. It generates 21 quantile predictions per forecast horizon without any fine-tuning on your data.

Zero-Shot Inference Paradigm#

Unlike learned models (QR, parametric) that fit to your dataset:

# Learned model: fit on training data, then predict
qr_model = QRXGBOOSTConfig()
forecaster = TwigaForecaster(data_config, [qr_model])
forecaster.fit(train_df)  # ← Parameters optimized to train_df
forecaster.predict(test_df)

Foundational models skip the fitting step:

# Foundational model: download weights, then predict (no fit optimization)
chronos = Chronos2Config(device="cpu")
forecaster = TwigaForecaster(data_config, [chronos])
forecaster.fit(train_df)  # ← Downloads pre-trained weights, validates dimensions only
forecaster.predict(test_df)

The training phase validates shapes and prepares the data pipeline, but does not optimize parameters. All predictive knowledge comes from the 2M+ time series in pre-training.

Quantile Levels#

Chronos2 outputs 21 fixed quantile levels. These are architectural and cannot be changed:

[0.025, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45,
 0.5 (median),
 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 0.975]

These levels provide 95% nominal coverage (0.025 to 0.975) with fine granularity in the center and tails. If custom quantiles are required, use Quantile Regression models instead.

Device Selection#

Chronos2 supports three compute devices for inference:

Device

Use case

Performance

'cpu'

Default, broad compatibility

~seconds per batch

'cuda'

NVIDIA GPUs (large batches)

~100ms per large batch on V100/A100

'mps'

Apple Silicon (M1/M2/M3 chips)

~500ms per batch on M1 Pro

Device defaults to 'cpu'. Switch at config time:

config = Chronos2Config(device="cuda")
forecaster = TwigaForecaster(data_config, [config])

GPU Inference

For production batch inference, 'cuda' with batch sizes 64–256 is 10–100× faster than CPU. For single-step or small batches (<32), CPU overhead is comparable.

Monotonicity Enforcement#

Chronos2 quantile predictions are enforced to be monotonically increasing (Q₀.₁ ≤ Q₀.₂ ≤ … ≤ Q₀.₉) to respect the definition of quantiles. Three strategies control enforcement:

Strategy

Method

Speed

Use case

'sort'

Sort along quantile axis

Fastest

Default; respects quantile order absolutely

'isotonic'

Isotonic regression per (horizon, target)

Slower; preserves more prediction structure

When crossing quantiles indicate model miscalibration

'none'

No enforcement

Fastest

Research / diagnostic; warnings enabled

config = Chronos2Config(enforce_monotonic="sort")  # default

All strategies are applied post-inference and do not affect weight loading or latency significantly.

Chronos2Config#

Field

Type

Default

Description

name

Literal["chronos2"]

"chronos2"

Model identifier. Excluded from parameter dumps.

domain

Literal["foundational"]

"foundational"

Domain identifier. Excluded from parameter dumps.

device

Literal["cpu", "cuda", "mps"]

"cpu"

Compute device for inference.

enforce_monotonic

Literal["sort", "isotonic", "none"]

"sort"

Monotonicity enforcement strategy.

search_space

BaseSearchSpace

empty

No hyperparameter tuning; omitted from Optuna trials.

No search space: Chronos2 has no tunable hyperparameters. The search_space field is always empty. All behavior is controlled via the config fields above.

Example: Zero-Shot Forecasting#

import pandas as pd
from twiga import TwigaForecaster
from twiga.core.config import DataPipelineConfig, ExperimentConfig
from twiga.models.foundational.chronos2_model import Chronos2Config

# Load data
data = pd.read_parquet("my_timeseries.parquet")
train_df = data[data["timestamp"] < "2024-01-01"]
test_df = data[data["timestamp"] >= "2024-01-01"]

# Configure pipeline and model
data_config = DataPipelineConfig(
    target_feature="load",
    period="30min",
    forecast_horizon=48,
    lookback_window_size=96,
    latitude=40.0,
    longitude=-75.0,
    calendar_features=["hour", "day_of_week"],
)

chronos = Chronos2Config(device="cpu")

# Create forecaster
forecaster = TwigaForecaster(data_config, [chronos])

# Fit (loads weights, no training)
forecaster.fit(train_df)

# Predict
predictions, metrics = forecaster.evaluate_quantile_forecast(test_df)

# Access quantiles
print(predictions.columns)  # ['timestamp', 'Actual', 'forecast', 'q_0.025', 'q_0.05', ..., 'q_0.975']

Example: Ensemble with Learned Models#

Combine Chronos2 (zero-shot) with learned models for robustness:

from twiga.models.ml import QRXGBOOSTConfig

configs = [
    Chronos2Config(device="cpu"),
    QRXGBOOSTConfig(),
]

forecaster = TwigaForecaster(
    data_config,
    configs,
    ensemble_strategy="median_quantiles",
)

forecaster.fit(train_df)
predictions, metrics = forecaster.evaluate_quantile_forecast(test_df)

The ensemble median across Chronos2 and QR-XGBoost provides blended uncertainty.

Additional Zero-Shot Models#

Alongside Chronos2, Twiga wraps four more zero-shot foundation models. All share the same TwigaForecaster interface and emit 9 quantile levels ([0.1, 0.2, …, 0.9]). Each requires an optional package that is not pulled in by twiga[foundational] (which ships only Chronos2 + torch); the install notes below are also surfaced in the model docstrings.

All four configs follow the Chronos2 device convention: device="auto" (the default) selects CUDA → MPS → CPU automatically, or pin "cuda", "mps", or "cpu".

TabICLModel#

A tabular foundation model that forecasts via in-context learning over engineered temporal features rather than autoregressive token decoding. Its pre-training mixes synthetic and real tabular datasets, so it generalises across domains without per-task fitting. Inference is ensembled across n_estimators members (4–8 is a good CPU speed/quality trade-off).

Installation

pip install "tabicl[forecast]>=2.1". Not included in twiga[foundational]: tabicl transitively pins numpy < 2.2 via gluonts, which conflicts with the rest of the stack. Install it into a dedicated environment.

MoiraiModel#

Salesforce’s universal time-series transformer, loaded through the uni2ts package and run via the GluonTS predictor pipeline. The model_type field selects the variant: "moirai2" (v2.0, native quantile output — the default), "moirai" (v1.x, sample-based), or "moirai-moe" (mixture-of-experts, sample-based). Sample-based variants draw num_samples paths and reduce them to the 9-quantile grid; Moirai 2.0 emits quantiles directly.

Installation

pip install "uni2ts>=1.2".

TimesFMModel#

Google Research’s TimesFM 2.5, a 200M-parameter decoder-only transformer with a 16k-token context and a continuous quantile head. It forecasts autoregressively like Chronos2 but at a fraction of the parameter count, exposing its 9 native quantile levels.

Installation

Not on PyPI — install from source: pip install "git+https://github.com/google-research/timesfm.git#egg=timesfm[torch]".

LagLlamaModel#

The first open-source time-series foundation model: a decoder-only transformer that ingests lag features rather than raw sequences. It is sample-based — the wrapper draws num_samples paths per series and reduces them to the 9-quantile grid. The wrapper resolves a relative ckpt_path against the CWD, the model-file directory, and ancestor directories up to the project root.

Installation

Install the package, then download the checkpoint (a separate manual step):

pip install git+https://github.com/time-series-foundation-models/lag-llama.git
pip install "gluonts[torch]<=0.14.4" pytorch-lightning
huggingface-cli download time-series-foundation-models/Lag-Llama \
    lag-llama.ckpt --local-dir lag-llama

BaseFoundationalModel#

Internal abstract base class for foundational models. Custom foundational models should inherit from this class and implement:

class MyFoundationalModel(BaseFoundationalModel):
    quantile_levels = [0.1, 0.5, 0.9]  # Define fixed quantiles

    def __init__(self, model_config):
        super().__init__(
            data_pipeline=None,
            model_instance=None,
            quantiles=self.quantile_levels,
            conf_level=0.05,
            enforce_monotonic="sort",
        )
        self.model_config = model_config

    def _initialize_models(self):
        """Load pre-trained weights from external source."""
        self.model = load_pretrained_weights(...)

    def _predict(self, x):
        """Generate quantile predictions."""
        return self.model.predict(x)  # shape (B, n_quantiles, horizon, n_targets)

See Custom Models for a complete walkthrough.

Advantages vs. Disadvantages#

Advantages#

No training cost — Download weights, forecast immediately (seconds to setup) ✅ Robust to domain shift — Pre-trained on 2M+ diverse series ✅ Works on small datasets — No overfitting risk; better than underfitted QR on <500 samples ✅ Automatic uncertainty — 21 quantiles without explicit calibration ✅ Ensemble-ready — Mix with learned models for blended forecasts ✅ Simple API — One config, identical to learned models

Disadvantages#

Slow inference — ~seconds per batch (vs. ~10ms for tree models) ❌ Fixed quantiles — Cannot request custom τ values; must accept 21 levels ❌ Univariate only — No multivariate or multi-output support (current gen) ❌ May underperform — On specialized domains with abundant domain-specific training data ❌ Black-box — Cannot inspect or fine-tune learned parameters (by design)

Comparison with Other Quantile Models#

Model

Training

Inference

Quantiles

Uncertainty Calibration

Use case

Chronos2 (foundational)

None (zero-shot)

~seconds

21 fixed

Automatic (pre-trained)

Rapid prototyping, domain transfer, small data

QR-XGBoost (ML)

Minutes to hours

~10ms

Any τ

Manual (calibration step)

Production, custom quantiles, large data

QR-MLPF (NN)

Hours (GPU)

~50ms

Any τ

Manual (calibration step)

High-capacity, complex patterns, very large data

FPQR-MLPGAM (NN)

Hours (GPU)

~50ms

Any τ

Learned (output layer)

Adaptive quantile bounds, complex interactions

References#

API Reference#

BaseFoundationalModel#

class twiga.models.foundational.base.BaseFoundationalModel(data_pipeline=None, model_instance=None, model_config=None, quantiles=None, conf_level=0.05, enforce_monotonic='sort', *, horizon=None, num_targets=1)#

Bases: BaseQuantileRegressor

Base for zero-shot foundation models (Chronos, GPT4TS, etc).

Foundation models are pre-trained on diverse data and produce fixed quantile outputs without fine-tuning on the target dataset. They inherit from BaseQuantileRegressor to leverage quantile-specific logic like monotonicity enforcement and multi-output support.

Zero-shot use — no fit() required:

Subclasses call _ensure_loaded() at the start of _predict(), which lazily loads model weights on the first predict() call:

model = Chronos2Model(Chronos2Config(device="cuda"), horizon=24)
quantiles = model.predict(x)  # weights loaded here automatically

Explicit fit() is still supported for upfront validation and warm-starting (avoids cold-start latency on the first fold):

model.fit(X_train, y_train) # optional, pre-loads weights quantiles = model.predict(x)

Subclasses must define:

  • quantile_levels — fixed quantile list from the model architecture.

  • _initialize_models() — download / load pre-trained weights and assign to self.model.

  • _predict() — call _ensure_loaded() then run inference.

Parameters:
  • data_pipeline – Feature preprocessing pipeline (typically None).

  • model_instance – Model instance class (typically None).

  • model_config – Model config dict (handled by subclass).

  • quantiles (list[float] | None) – Fixed quantile levels from the architecture.

  • conf_level (float) – Confidence level reference (default 0.05).

  • enforce_monotonic (str) – Monotonicity strategy ("sort" / "isotonic" / "none").

  • horizon (int | None) – Optional forecast horizon hint. When provided, allows predict() to be called without a prior fit().

  • num_targets (int) – Number of target variables (default 1). Foundation models are typically univariate.

quantile_levels: list[float] = []#
set_fit_request(*, eval_set='$UNCHANGED$', trial='$UNCHANGED$', verbose='$UNCHANGED$')#

Configure whether metadata should be requested to be passed to the fit method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to fit if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to fit.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters#

eval_setstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for eval_set parameter in fit.

trialstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for trial parameter in fit.

verbosestr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for verbose parameter in fit.

Returns#

selfobject

The updated object.

set_predict_request(*, sigma='$UNCHANGED$')#

Configure whether metadata should be requested to be passed to the predict method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to predict if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to predict.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters#

sigmastr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for sigma parameter in predict.

Returns#

selfobject

The updated object.

set_score_request(*, sample_weight='$UNCHANGED$')#

Configure whether metadata should be requested to be passed to the score method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to score if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to score.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters#

sample_weightstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for sample_weight parameter in score.

Returns#

selfobject

The updated object.

Chronos2Model#

class twiga.models.foundational.chronos2_model.Chronos2Model(model_config=None)#

Bases: BaseFoundationalModel

Zero-shot forecasting with Chronos-2.

Chronos-2 is a 12B-parameter autoregressive transformer that performs zero-shot time series forecasting without fine-tuning on the target dataset. It produces 21 quantile predictions spanning [0.025, 0.05, …, 0.95, 0.975].

fit() is optional — model weights are loaded lazily on the first predict() call:

# Zero-shot: no fit() required when horizon is known
model = Chronos2Model(Chronos2Config(horizon=24))
quantiles = model.predict(x)  # loads weights from HuggingFace here

# Explicit pre-loading (avoids cold-start on first fold)
model.fit(X_train, y_train)
quantiles = model.predict(x)

The model loads pre-trained weights from HuggingFace on first use. No fine-tuning or gradient updates happen on the provided data.

Parameters:

model_config (Chronos2Config | None) – Chronos2Config with device and horizon settings.

Example:

config = Chronos2Config(device="cuda", horizon=24)
model = Chronos2Model(config)
quantiles = model.predict(X_test)  # shape: (batch, horizon, 21)
__init__(model_config=None)#

Initialize Chronos-2 model.

Parameters:

model_config (Chronos2Config | None) – Configuration with device and horizon settings. Defaults to Chronos2Config (device 'auto').

fit(X, y, eval_set=None, verbose=False)#

Pre-load Chronos-2 weights (optional — called automatically on first predict).

No training occurs. fit() validates array dimensions and loads the pre-trained pipeline from HuggingFace so that the first fold of a backtesting loop does not pay the cold-start cost.

Parameters:
  • X (ndarray) – Lookback features, shape (batch, seq_len, n_features). Used for dimension validation only.

  • y (ndarray) – Forecast targets, shape (batch, horizon, n_targets). Used for dimension validation only.

  • eval_set (tuple[ndarray, ndarray] | None) – Ignored.

  • verbose (bool) – Ignored.

Return type:

Chronos2Model

Returns:

Self for method chaining.

Raises:
  • ValueError – If X/y are not 3-D or n_targets > 1.

  • ImportError – If the chronos-forecasting library is not installed.

  • RuntimeError – If HuggingFace model loading fails.

quantile_levels: list[float] = [0.025, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 0.975]#
set_fit_request(*, eval_set='$UNCHANGED$', verbose='$UNCHANGED$')#

Configure whether metadata should be requested to be passed to the fit method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to fit if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to fit.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters#

eval_setstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for eval_set parameter in fit.

verbosestr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for verbose parameter in fit.

Returns#

selfobject

The updated object.

set_predict_request(*, sigma='$UNCHANGED$')#

Configure whether metadata should be requested to be passed to the predict method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to predict if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to predict.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters#

sigmastr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for sigma parameter in predict.

Returns#

selfobject

The updated object.

set_score_request(*, sample_weight='$UNCHANGED$')#

Configure whether metadata should be requested to be passed to the score method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to score if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to score.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters#

sample_weightstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for sample_weight parameter in score.

Returns#

selfobject

The updated object.

Chronos2Config#

class twiga.models.foundational.chronos2_model.Chronos2Config(**data)#

Bases: BaseModelConfig

Configuration for Chronos-2 zero-shot forecasting.

Chronos-2 is a 12B-parameter autoregressive transformer trained on 2M+ diverse time series. It performs zero-shot forecasting without fine-tuning on the target dataset and produces 21 quantile predictions.

Fixed quantiles: 0.025, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45,

0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 0.975

Variables:
  • name – Model identifier, fixed to 'chronos2'.

  • domain – Domain identifier, fixed to 'foundational'.

  • device – Compute device. "auto" (default) selects CUDA when available, then MPS (Apple Silicon), then CPU. Pass "cuda", "mps", or "cpu" to override.

  • horizon – Optional forecast horizon hint. When set, predict() can be called without a prior fit().

  • enforce_monotonic – Monotonicity enforcement strategy.

device: str#
domain: Literal['foundational']#
enforce_monotonic: Literal['sort', 'isotonic', 'none']#
horizon: int | None#
model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: Literal['chronos2']#

TabICLModel#

class twiga.models.foundational.tabicl_model.TabICLModel(model_config=None)#

Bases: BaseFoundationalModel

Zero-shot forecasting with TabICLv2.

TabICLv2 is a tabular foundation model that supports time series forecasting via in-context learning over engineered temporal features. It produces 9 quantile predictions: [0.1, 0.2, …, 0.9].

The model loads pre-trained weights from HuggingFace via the tabicl package. No training happens on the input data; fit() only validates dimensions and instantiates the forecaster.

Parameters:

model_config (TabICLConfig | None) – TabICLConfig with device, n_estimators, and other options.

Example

>>> config = TabICLConfig(device="cuda", n_estimators=8)
>>> model = TabICLModel(model_config=config)
>>> model.fit(X_train, y_train)
>>> quantiles = model.predict(X_test)
__init__(model_config=None)#

Initialize TabICLv2 model.

Parameters:

model_config (TabICLConfig | None) – Configuration. Defaults to TabICLConfig().

fit(X, y, eval_set=None, verbose=False)#

Load pre-trained TabICLv2 forecaster.

The input data is not used for training; fit() instantiates the zero-shot forecaster (which lazily downloads weights from HuggingFace on first predict) and validates array dimensions.

Parameters:
  • X (ndarray) – Lookback window features, shape (batch, seq_len, n_features). Used only for dimension validation.

  • y (ndarray) – Target forecast horizons, shape (batch, horizon, n_targets). Used only for dimension validation.

  • eval_set (tuple[ndarray, ndarray] | None) – Ignored (included for interface compatibility).

  • verbose (bool) – Ignored (included for interface compatibility).

Return type:

TabICLModel

Returns:

Self for method chaining.

Raises:
  • ImportError – If the tabicl library is not installed.

  • ValueError – If inputs are not 3-D or num_targets != 1.

quantile_levels: list[float] = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]#
set_fit_request(*, eval_set='$UNCHANGED$', verbose='$UNCHANGED$')#

Configure whether metadata should be requested to be passed to the fit method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to fit if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to fit.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters#

eval_setstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for eval_set parameter in fit.

verbosestr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for verbose parameter in fit.

Returns#

selfobject

The updated object.

set_predict_request(*, sigma='$UNCHANGED$')#

Configure whether metadata should be requested to be passed to the predict method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to predict if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to predict.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters#

sigmastr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for sigma parameter in predict.

Returns#

selfobject

The updated object.

set_score_request(*, sample_weight='$UNCHANGED$')#

Configure whether metadata should be requested to be passed to the score method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to score if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to score.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters#

sample_weightstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for sample_weight parameter in score.

Returns#

selfobject

The updated object.

TabICLConfig#

class twiga.models.foundational.tabicl_model.TabICLConfig(**data)#

Bases: BaseModelConfig

Configuration for TabICLv2 zero-shot forecasting.

TabICLv2 is a tabular foundation model that performs time series forecasting by converting temporal sequences into tabular features and using in-context learning. It produces quantile predictions without fine-tuning on the target dataset.

Fixed default quantiles: 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9.

Variables:
  • name – Model identifier, fixed to ‘tabicl’.

  • domain – Domain identifier, fixed to ‘foundational’.

  • device – Compute device. ‘auto’ (default) picks CUDA → MPS → CPU.

  • n_estimators – Number of ensemble members (higher = better, slower).

  • max_context_length – Maximum number of historical timesteps fed to the model.

  • point_estimate – Aggregation strategy for the point forecast (‘mean’ or ‘median’).

  • enforce_monotonic – Strategy for non-crossing quantiles.

device: str#
domain: Literal['foundational']#
enforce_monotonic: Literal['sort', 'isotonic', 'none']#
max_context_length: int#
model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

n_estimators: int#
name: Literal['tabicl']#
point_estimate: Literal['mean', 'median']#

MoiraiModel#

class twiga.models.foundational.moirai_model.MoiraiModel(model_config=None)#

Bases: BaseFoundationalModel

Zero-shot forecasting with Moirai (v1.x, MoE, or v2.0).

Loads pre-trained weights from HuggingFace via the uni2ts package and runs the GluonTS predictor pipeline. Output samples (or native quantiles for moirai2) are reduced to 9 quantile levels.

Parameters:

model_config (MoiraiConfig | None) – MoiraiConfig controlling variant, size, and device.

Example

>>> config = MoiraiConfig(model_type="moirai2", size="small", device="cpu")
>>> model = MoiraiModel(model_config=config)
>>> model.fit(X_train, y_train)
>>> quantiles = model.predict(X_test)
__init__(model_config=None)#

Initialize Moirai model.

Parameters:

model_config (MoiraiConfig | None) – Configuration. Defaults to MoiraiConfig().

fit(X, y, eval_set=None, verbose=False)#

Load pre-trained Moirai module.

Parameters:
  • X (ndarray) – Lookback window features, shape (batch, seq_len, n_features). Used only for dimension validation.

  • y (ndarray) – Target forecast horizons, shape (batch, horizon, n_targets). Used only for dimension validation.

  • eval_set (tuple[ndarray, ndarray] | None) – Ignored (included for interface compatibility).

  • verbose (bool) – Ignored (included for interface compatibility).

Return type:

MoiraiModel

Returns:

Self for method chaining.

quantile_levels: list[float] = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]#
set_fit_request(*, eval_set='$UNCHANGED$', verbose='$UNCHANGED$')#

Configure whether metadata should be requested to be passed to the fit method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to fit if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to fit.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters#

eval_setstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for eval_set parameter in fit.

verbosestr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for verbose parameter in fit.

Returns#

selfobject

The updated object.

set_predict_request(*, sigma='$UNCHANGED$')#

Configure whether metadata should be requested to be passed to the predict method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to predict if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to predict.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters#

sigmastr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for sigma parameter in predict.

Returns#

selfobject

The updated object.

set_score_request(*, sample_weight='$UNCHANGED$')#

Configure whether metadata should be requested to be passed to the score method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to score if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to score.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters#

sample_weightstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for sample_weight parameter in score.

Returns#

selfobject

The updated object.

MoiraiConfig#

class twiga.models.foundational.moirai_model.MoiraiConfig(**data)#

Bases: BaseModelConfig

Configuration for Moirai zero-shot forecasting.

Moirai is a transformer foundation model with three publicly released variants:

  • moirai: original v1.1 — sample-based output.

  • moirai-moe: mixture-of-experts variant — sample-based output.

  • moirai2: v2.0 — direct quantile output.

Variables:
  • name – Model identifier, fixed to ‘moirai’.

  • domain – Domain identifier, fixed to ‘foundational’.

  • model_type – Which Moirai variant to load.

  • size – Model size; one of ‘small’, ‘base’, ‘large’.

  • device – Compute device. ‘auto’ (default) picks CUDA → MPS → CPU.

  • patch_size – Patch size for sample-based variants (‘auto’ or 8/16/32/64/128). Ignored for moirai2.

  • num_samples – Number of probabilistic samples to draw from sample-based variants before computing empirical quantiles. Ignored for moirai2.

  • frequency – Pandas frequency alias for the input series. If None, uses data_pipeline.period when available, else '1h'.

  • enforce_monotonic – Strategy for non-crossing quantiles.

device: str#
domain: Literal['foundational']#
enforce_monotonic: Literal['sort', 'isotonic', 'none']#
frequency: str | None#
model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_type: Literal['moirai', 'moirai-moe', 'moirai2']#
name: Literal['moirai']#
num_samples: int#
patch_size: int | Literal['auto']#
size: Literal['small', 'base', 'large']#

TimesFMModel#

class twiga.models.foundational.timesfm_model.TimesFMModel(model_config=None)#

Bases: BaseFoundationalModel

Zero-shot forecasting with TimesFM 2.5.

Loads pre-trained weights from HuggingFace via the timesfm package and runs univariate zero-shot inference. The continuous quantile head emits 9 quantile levels: [0.1, 0.2, …, 0.9].

Parameters:

model_config (TimesFMConfig | None) – TimesFMConfig controlling device, context, and horizon.

Example

>>> config = TimesFMConfig(device="cpu")
>>> model = TimesFMModel(model_config=config)
>>> model.fit(X_train, y_train)
>>> quantiles = model.predict(X_test)
__init__(model_config=None)#

Initialize TimesFM 2.5 model.

Parameters:

model_config (TimesFMConfig | None) – Configuration. Defaults to TimesFMConfig().

fit(X, y, eval_set=None, verbose=False)#

Load and compile the pre-trained TimesFM 2.5 model.

Parameters:
  • X (ndarray) – Lookback window features, shape (batch, seq_len, n_features). Used for dimension validation and to size the context window.

  • y (ndarray) – Target forecast horizons, shape (batch, horizon, n_targets). Used for dimension validation and to size the horizon.

  • eval_set (tuple[ndarray, ndarray] | None) – Ignored (included for interface compatibility).

  • verbose (bool) – Ignored (included for interface compatibility).

Return type:

TimesFMModel

Returns:

Self for method chaining.

quantile_levels: list[float] = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]#
set_fit_request(*, eval_set='$UNCHANGED$', verbose='$UNCHANGED$')#

Configure whether metadata should be requested to be passed to the fit method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to fit if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to fit.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters#

eval_setstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for eval_set parameter in fit.

verbosestr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for verbose parameter in fit.

Returns#

selfobject

The updated object.

set_predict_request(*, sigma='$UNCHANGED$')#

Configure whether metadata should be requested to be passed to the predict method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to predict if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to predict.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters#

sigmastr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for sigma parameter in predict.

Returns#

selfobject

The updated object.

set_score_request(*, sample_weight='$UNCHANGED$')#

Configure whether metadata should be requested to be passed to the score method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to score if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to score.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters#

sample_weightstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for sample_weight parameter in score.

Returns#

selfobject

The updated object.

TimesFMConfig#

class twiga.models.foundational.timesfm_model.TimesFMConfig(**data)#

Bases: BaseModelConfig

Configuration for TimesFM 2.5 zero-shot forecasting.

Variables:
  • name – Model identifier, fixed to ‘timesfm’.

  • domain – Domain identifier, fixed to ‘foundational’.

  • device – Compute device. ‘auto’ (default) picks CUDA → MPS → CPU.

  • max_context – Maximum context length compiled into the model (capped at TimesFM’s 16k token limit). Auto-raised to the lookback window at fit time if the configured value is smaller.

  • max_horizon – Maximum forecast horizon compiled into the model. Auto-raised to the requested horizon at fit time if smaller.

  • hf_repo – HuggingFace checkpoint id.

  • enforce_monotonic – Strategy for non-crossing quantiles.

device: str#
domain: Literal['foundational']#
enforce_monotonic: Literal['sort', 'isotonic', 'none']#
hf_repo: str#
max_context: int#
max_horizon: int#
model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: Literal['timesfm']#

LagLlamaModel#

class twiga.models.foundational.lag_llama_model.LagLlamaModel(model_config=None)#

Bases: BaseFoundationalModel

Zero-shot forecasting with Lag-Llama.

Parameters:

model_config (LagLlamaConfig | None) – LagLlamaConfig pointing at the local checkpoint.

Example

>>> config = LagLlamaConfig(ckpt_path="lag-llama/lag-llama.ckpt", device="cpu")
>>> model = LagLlamaModel(model_config=config)
>>> model.fit(X_train, y_train)
>>> quantiles = model.predict(X_test)
__init__(model_config=None)#

Initialize Lag-Llama model.

Parameters:

model_config (LagLlamaConfig | None) – Configuration. Defaults to LagLlamaConfig().

fit(X, y, eval_set=None, verbose=False)#

Load the Lag-Llama checkpoint (zero-shot — no training).

Parameters:
  • X (ndarray) – Lookback window features, shape (batch, seq_len, n_features). Used for dimension validation and to size the context budget.

  • y (ndarray) – Target forecast horizons, shape (batch, horizon, n_targets). Used for dimension validation and to size the prediction length.

  • eval_set (tuple[ndarray, ndarray] | None) – Ignored (included for interface compatibility).

  • verbose (bool) – Ignored (included for interface compatibility).

Return type:

LagLlamaModel

Returns:

Self for method chaining.

quantile_levels: list[float] = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]#
set_fit_request(*, eval_set='$UNCHANGED$', verbose='$UNCHANGED$')#

Configure whether metadata should be requested to be passed to the fit method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to fit if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to fit.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters#

eval_setstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for eval_set parameter in fit.

verbosestr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for verbose parameter in fit.

Returns#

selfobject

The updated object.

set_predict_request(*, sigma='$UNCHANGED$')#

Configure whether metadata should be requested to be passed to the predict method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to predict if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to predict.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters#

sigmastr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for sigma parameter in predict.

Returns#

selfobject

The updated object.

set_score_request(*, sample_weight='$UNCHANGED$')#

Configure whether metadata should be requested to be passed to the score method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to score if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to score.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters#

sample_weightstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for sample_weight parameter in score.

Returns#

selfobject

The updated object.

LagLlamaConfig#

class twiga.models.foundational.lag_llama_model.LagLlamaConfig(**data)#

Bases: BaseModelConfig

Configuration for Lag-Llama zero-shot forecasting.

Variables:
  • name – Model identifier, fixed to ‘lag_llama’.

  • domain – Domain identifier, fixed to ‘foundational’.

  • ckpt_path – Path to the lag-llama.ckpt checkpoint. The repo source is expected at the same directory (added to sys.path at fit time).

  • context_length – Total memory budget passed to the estimator (the transformer context + lag features). Auto-raised at fit time if the data’s lookback is larger.

  • device – Compute device. ‘auto’ (default) picks CUDA → MPS → CPU.

  • num_samples – Number of probabilistic samples drawn per series before computing empirical quantiles.

  • enforce_monotonic – Strategy for non-crossing quantiles.

ckpt_path: str#
context_length: int#
device: str#
domain: Literal['foundational']#
enforce_monotonic: Literal['sort', 'isotonic', 'none']#
model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: Literal['lag_llama']#
num_samples: int#