IBM PatchTST-FM pretrained foundation model for time series forecasting.
Uses the zero-shot pretrained PatchTST-FM (ibm-research/patchtst-fm-r1) from IBM, a ~260M parameter model that achieves state-of-the-art results on GIFT-Eval. Requires granite-tsfm from the patchtst-fm branch.
PatchtstFmHyperparams
patchtst_fm_model.PatchtstFmHyperparams
Stochastic output shape (pretrained weights fixed; no training grid).
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
stochastic_samples |
int |
100 |
How many quantiles to subsample into pseudo-samples at predict time. |
PatchtstFmModel
patchtst_fm_model.PatchtstFmModel
IBM PatchTST-FM pretrained foundation model wrapper.
Zero-shot stochastic forecasting via the granite-tsfm package (patchtst-fm branch). PatchTST-FM outputs quantile forecasts which are converted to pseudo-samples.
__init__(self, params: Dict[str, Any], settings: Dict[str, Any])
| 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, **kwargs) -> PatchtstFmModel
Load pretrained PatchTST-FM (no training required for foundation models).
Parameters:
| 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: PatchtstFmModel (Self).
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, **kwargs) -> np.ndarray
Parameters:
| 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 (The predicted samples, shape (num_samples, forecast_horizon, num_targets)).
Raises: ValueError if PatchtstFmModel is not fitted (i.e., train() has not been called).