Skip to content

Options

Options are a single JSON object in the last argument. Unknown keys and wrong-typed values are rejected with PREDICT_ERR_OPTIONS, so a typo fails loud rather than being ignored.

Key Type Default Meaning
model string auto A model id to pin, or auto (the default: best of the stats plus eligible registered students, per series).
confidence_level number (0,1) 0.9 Nominal coverage of the interval.
interval_method residual | conformal residual Interval construction.
folds integer 20 Rolling origins used by auto / conformal.
gap integer 0 Leakage guard between train and target.
candidates string[] stat models + eligible registered students Narrows the auto pool.
context_limit integer 4096 Cap on points fed to the model (the most recent are kept; a capped series reports status truncated).

Aggregate rules: the options argument and horizon must be the same value on every row of a group, and a SELECT string passed as the first argument is rejected with an error explaining that forecast is an aggregate over your rows. There are no column-naming keys: the argument positions carry the columns and GROUP BY carries the series split.

model and context_limit as above, except that model defaults to theta-classic (the residual detector) and context_limit defaults to 0: the detector scores the whole series unless you cap it. Plus:

Key Type Default Meaning
anomaly_prob_threshold number (0,1) 0.99 Probability above which a point is flagged.

The same aggregate rules apply.

An aggregate over your rows, like forecast. confidence_level, interval_method, folds, gap, and context_limit as for forecast. model differs: it must be a statistical model id or auto, and it defaults to theta-classic, not auto; a distilled student competes inside auto but cannot be pinned here. There are no column-naming keys: the argument positions carry the columns and GROUP BY carries the series split.

fit([name,] f1, ..., fN, label [, options]) trains a native tabular student over your rows; the label is the last argument before the optional options, so there is no target option. An optional leading TEXT argument names and registers the model, fit('id', f..., label), mirroring predict('id', f...). The leading name and the options object must be constant within an aggregate group.

Key Type Default Meaning
kind gbt | tree gbt Student architecture.
task classify | regress classify Default classify (the label is read as a class). Pass regress for a numeric target; a real-valued label is not inferred.
register string none Register the model under this id and return the id; without it, fit returns a model blob. The id can instead be given as a leading positional argument, fit('id', ...); supplying it both ways raises PREDICT_ERR_OPTIONS.

A scalar: predict(model, f1, ..., fN [, options]). model is a registered id or a fit() blob; features are positional.

Key Type Default Meaning
proba 0 | 1 0 Return a {"prediction": "1", "confidence": 0.98} JSON document instead of the bare label.

The batched and in-context serving path, predict_batch(train_query, apply_query [, options]).

Key Type Default Meaning
target string required for in-context models Column in train_query to learn. A served model (train_query = NULL) needs no target.
task classify | regress inferred Prediction task.
model string knn5-incontext An in-context model, a registered native student id (trained by distill_predict or fit), or a registered onnx id. To serve an already-trained model (a native student or onnx), pass train_query = NULL; only in-context models take a train_query.
device cpu | gpu cpu Inference device (onnx build).
precision string model default Inference precision (onnx build).
accept_license 0 | 1 0 Accept a license-tagged model.

target and student_id are required. Feature columns must be numeric: encode categorical text before distilling (the in-context knn5-incontext handles text features itself; the distiller does not).

Key Type Meaning
target string Target column. Required.
task classify | regress Task. Inferred when omitted.
student_id string Id to register the student under. Required.
student_kind tree | gbt | mlp Student architecture. Default tree (soft-label distillation implies gbt).
teacher string A registered model that relabels the training rows first.
proba, classes string[] Soft-label distillation: per-class probability columns and their class labels.

context, horizon, and student_id are required. Without a teacher, each train_query row is one training window laid out by position: context input columns, then the horizon continuation columns (or horizon * nquant quantile columns when quantiles is passed); the column count must match exactly.

Key Type Meaning
student_id string Id to register the student under. Required.
teacher string Teacher forecast model (onnx build): train_query then yields (series_key, value) rows and the teacher labels sliding windows.
context integer Input window length. Required; max 4096.
horizon integer Forecast length the student is trained for. Required.
quantiles number[] Quantile levels to distill from a teacher’s quantile fan. Default: a point (median-only) student.
hidden integer Residual-net hidden width, 0 to 2048 (0 = pure linear student). Default 256.
epochs, lr Training epochs (default 1500) and learning rate (default 0.005).