ThetaEstimationMethod
theta_model.ThetaEstimationMethod · inherits StrEnum
StrEnum avoids Pydantic 2.12+ ""class not fully defined"" with Literal under PEP 563.
| Member | Value |
|---|---|
least_squares |
"least_squares" |
correlation_optimal |
"correlation_optimal" |
ThetaHyperparams
theta_model.ThetaHyperparams · inherits PydanticBaseModel
Configuration structure for Theta Model hyperparameters.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
sp |
int |
- | Seasonal period |
theta_method |
ThetaEstimationMethod |
- | Method for theta estimation |
use_reduced_rank |
bool |
False |
Whether to use cointegration/reduced rank |
ThetaModel
theta_model.ThetaModel · inherits BaseModel
Theta model for univariate, multivariate, and covariate (stacked exogenous) benchmarks.
Multivariate tasks (multiple joint targets, no exogenous stack) fit one independent ThetaForecaster per target column. Covariate tasks (optional past_covariates / x_context) are concatenated during a joint Θ-line pipeline.
__init__(self, params: Dict[str, Any], settings: Dict[str, Any])
Initializes the ThetaModel, setting up internal state and parsing hyperparameters using ThetaHyperparams.
| Parameter | Type | Default | Description |
|---|---|---|---|
params |
Dict[str, Any] |
- | (undocumented) |
settings |
Dict[str, Any] |
- | (undocumented) |
train(self, y_context: np.ndarray, y_target: np.ndarray, timestamps_context: np.ndarray, timestamps_target: np.ndarray, x_context: Optional[np.ndarray] = None, x_target: Optional[np.ndarray] = None, past_covariates: Optional[np.ndarray] = None, **kwargs: dict) -> "ThetaModel"
Trains the Theta model on the provided context data. Handles independent multivariate fitting or joint Θ-matrix estimation based on the presence of covariates and data size.
| Parameter | Type | Default | Description |
|---|---|---|---|
y_context |
np.ndarray |
- | (undocumented) |
y_target |
np.ndarray |
- | (undocumented) |
timestamps_context |
np.ndarray |
- | (undocumented) |
timestamps_target |
np.ndarray |
- | (undocumented) |
x_context |
Optional[np.ndarray] |
None |
(undocumented) |
x_target |
Optional[np.ndarray] |
None |
(undocumented) |
past_covariates |
Optional[np.ndarray] |
None |
(undocumented) |
**kwargs |
dict |
- | (undocumented) |
Returns: Self (The fitted ThetaModel instance).
predict(self, y_context: np.ndarray, timestamps_context: np.ndarray, timestamps_target: np.ndarray, x_context: Optional[np.ndarray] = None, x_target: Optional[np.ndarray] = None, past_covariates: Optional[np.ndarray] = None, **kwargs: dict) -> np.ndarray
Generates forecasts for the target horizon based on the fitted model and context data.
| Parameter | Type | Default | Description |
|---|---|---|---|
y_context |
np.ndarray |
- | (undocumented) |
timestamps_context |
np.ndarray |
- | (undocumented) |
timestamps_target |
np.ndarray |
- | (undocumented) |
x_context |
Optional[np.ndarray] |
None |
(undocumented) |
x_target |
Optional[np.ndarray] |
None |
(undocumented) |
past_covariates |
Optional[np.ndarray] |
None |
(undocumented) |
**kwargs |
dict |
- | (undocumented) |
Returns: np.ndarray (The forecast mean, shape (forecast_horizon, num_original_targets)).
Raises:
| Exception | Description |
|---|---|
ValueError |
If the model is not trained yet. |
ValueError |
If past_covariates requirements are violated based on training configuration. |