Timesfm2Model
timesfm2_model.Timesfm2Model · inherits BaseModel
TimesFM 2.5 foundation model wrapper with stochastic (quantile) output.
Uses the transformers TimesFm2_5ModelForPrediction which returns both mean_predictions and full_predictions (quantiles). Quantiles are converted to pseudo-samples for stochastic metrics (CRPS, etc.).
__init__(self, params, settings)
Initializes the TimesFM 2.5 model wrapper.
| Parameter | Type | Default | Description |
|---|---|---|---|
| params | Dict[str, Any] |
- | (undocumented) |
| settings | Dict[str, Any] |
- | (undocumented) |
train(self, y_context, y_target, timestamps_context, timestamps_target, x_context=None, x_target=None, **kwargs) -> Timesfm2Model
Foundation model: no training needed. Build model and mark as fitted. Covariates (x_context, x_target) are ignored; TimesFM 2.5 has no native covariate support.
| 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) |
| **kwargs | - | (undocumented) |
Returns: Timesfm2Model (the fitted model).
predict(self, y_context, timestamps_context, timestamps_target, x_context=None, x_target=None, **kwargs) -> np.ndarray
Make predictions using TimesFM 2.5. Returns stochastic samples (num_samples, forecast_horizon, num_targets) from quantile forecasts. Covariates are ignored.
| 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) |
| **kwargs | - | (undocumented) |
Returns: np.ndarray (stochastic samples (num_samples, forecast_horizon, num_targets) from quantile forecasts).