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; call predict() 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 predict directly. Pass a single data table where the historical rows have the target column populated (in row order) and the horizon rows have the target column set to NULL; the Python API will synthesise an empty PAL pipeline model table and forward the pipeline JSON via the PIPELINE parameter. This auto-detection triggers when the Pipeline instance was built from pipeline= without a preceding fit; the behaviour can also be forced or suppressed via the skip_fit argument.

Parameters

Name

Data Type

Default Value

Description

BATCH_SIZE

INTEGER

128

Inference batch size. Must be in the range 1-512.

OUTPUT_QUANTILE

INTEGER

0

0: point forecast only; 1: also ship the full 21-quantile distribution. Forced to 1 when OUTPUT_PREDICTION_INTERVAL=1.

POINT_FORECAST

VARCHAR

"median"

How the point forecast is summarized from the quantile distribution. One of "median" or "mean".

CLIP_MIN

DOUBLE

unset

Lower clamp applied to forecast values (finite double). Forecast values below CLIP_MIN are replaced with it.

CLIP_MAX

DOUBLE

unset

Upper clamp applied to forecast values (finite double). Requires CLIP_MIN <= CLIP_MAX when both are set.

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_MIN values or CLIP_MIN > CLIP_MAX are 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 TimeSeries estimator category, so AutomaticTimeSeries can 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()