Pipeline Operator: TSFM¶
TSFM (Time Series Foundation Model) is a built-in pipeline operator that produces zero-shot forecasts. It is intended for univariate forecasting on tabular series with optional past and future covariates, and requires no per-dataset training.
Two usage patterns are supported:
Fit + predict. Call
fit()with a TSFM pipeline JSON to record the column structure and historical context in the model table; callpredict()with a horizon table to produce the forecast. The number of rows in the predict input table is the forecast horizon; any covariate columns become future covariates.Skip-fit inference. Call
predictdirectly. Pass a singledatatable where the historical rows have the target column populated (in row order) and the horizon rows have the target column set toNULL; the Python API will synthesise an empty PAL pipeline model table and forward the pipeline JSON via thePIPELINEparameter. This auto-detection triggers when thePipelineinstance was built frompipeline=without a precedingfit; the behaviour can also be forced or suppressed via theskip_fitargument.
Parameters¶
Name |
Data Type |
Default Value |
Description |
|---|---|---|---|
BATCH_SIZE |
INTEGER |
128 |
Inference batch size. Must be in the range |
OUTPUT_QUANTILE |
INTEGER |
0 |
|
POINT_FORECAST |
VARCHAR |
|
How the point forecast is summarized from the quantile distribution. One of |
CLIP_MIN |
DOUBLE |
unset |
Lower clamp applied to forecast values (finite double). Forecast values below |
CLIP_MAX |
DOUBLE |
unset |
Upper clamp applied to forecast values (finite double). Requires |
Notes¶
Per-series timestamps and detected interval are forwarded to the result table when present; if the input was supplied without a timestamp column, the operator falls back to the input ID column.
The target column carries at most 8192 historical points per series; longer inputs are silently truncated to the first 8192 points by the ts-service backend.
Non-finite
CLIP_MINvalues orCLIP_MIN > CLIP_MAXare rejected locally with a parameter validation error naming the offending parameter.TSFM is registered in the default and light AutoML config dict templates under the
TimeSeriesestimator category, soAutomaticTimeSeriescan select the operator during pipeline search.
Examples¶
Zero-shot forecast (skip-fit; recommended entry point):
import pandas as pd
from hana_ml.dataframe import create_dataframe_from_pandas
from hana_ml.algorithms.pal.pipeline import Pipeline
# `history` has (ID, OT) populated; `future` has (ID, OT=NULL) for the
# horizon rows. Concatenate the two and load as a single table.
combined = pd.concat([history, future], ignore_index=True)
hdf = create_dataframe_from_pandas(
cc, combined, table_name='#TSFM_INPUT', force=True,
table_structure={'ID': 'INTEGER', 'OT': 'DOUBLE'})
pipe = Pipeline(pipeline={
"TSFM": {
"args": {"POINT_FORECAST": "median"},
"inputs": {"data": "ROWDATA"},
}
})
forecast = pipe.predict(hdf, key='ID').collect() # skip-fit auto-detected
Fit-then-predict:
train_hdf = create_dataframe_from_pandas(cc, history, table_name='#TRAIN', force=True)
horizon_hdf = create_dataframe_from_pandas(
cc, pd.DataFrame({'ID': horizon_ids}), table_name='#HORIZON', force=True)
pipe = Pipeline(pipeline={"TSFM": {"args": {}, "inputs": {"data": "ROWDATA"}}})
pipe.fit(train_hdf, key='ID', endog='OT')
forecast = pipe.predict(horizon_hdf, key='ID').collect()
Via AutomaticTimeSeries as an explicit pipeline:
from hana_ml.algorithms.pal.auto_ml import AutomaticTimeSeries
auto_ts = AutomaticTimeSeries()
auto_ts.fit(data=train_hdf, key='ID', endog='OT',
pipeline='{"TSFM":{"args":{},"inputs":{"data":"ROWDATA"}}}')
forecast = auto_ts.predict(data=horizon_hdf, key='ID').collect()