API Reference / cli /

predict.py

Predict Command - Make predictions using trained models via CLI.

Functions

Func

parse_extra_args

Line 8
parse_extra_args(args)

Parse unrecognised command-line arguments into a keyword dictionary.

Leading dashes are stripped from each flag name. A flag followed by a non-flag token takes that token as its value, coerced to bool, int, or float when possible; a flag with no value becomes True.

Parameters

args
list of str
Raw leftover tokens, typically click.Context.args.

Returns

kwargs
dict
Mapping of flag name to parsed value.
Command

tuiml predict

Line 73
tuiml predict [OPTIONS]

Make predictions with a trained model.

Loads a model by ID or file path, applies it to a dataset, and prints a summary of the predictions, optionally writing them to CSV. Use --stage to ask for class probabilities instead of labels, or to forecast future steps with a timeseries model. Anomaly detectors additionally report how many instances were flagged.

Predict with a saved model and write the results to CSV:

bash
$ tuiml predict --model-path model.pkl -d new_data.csv -o predictions.csv

Predict using the model ID printed by "tuiml train":

bash
$ tuiml predict --model-id abc123 -d new_data.csv

Get class probabilities instead of labels:

bash
$ tuiml predict --model-path model.pkl -d new_data.csv --stage predict_proba

Forecast the next 12 steps of a timeseries model:

bash
$ tuiml predict --model-path arima.pkl --stage forecast --steps 12

Options

--model-path
Path to a saved model file (alternative to --model-id).
--data, -d
Path to a data file or a built-in dataset name to predict on.
--model-id
Model ID printed by "tuiml train" (alternative to --model-path).
--steps
int
Number of steps to forecast ahead. Timeseries models only.
--output, -o
Write the predictions to this file as CSV.
--stage
Prediction stage to run: 'predict', 'predict_proba', or 'forecast'. Defaults to 'predict'.
--json-output
flag
Print the raw JSON result instead of the formatted summary.
--verbose, -v
flag
Echo the resolved configuration and re-raise full tracebacks on error.