API Reference / agent / tools / workflow /

predict.py

Prediction and forecasting.

Functions

Func

execute_predict

Line 9
execute_predict(**kwargs) -> Dict[str, Any]

Execute prediction with support for timeseries and anomaly models.

Backs the tuiml_predict tool. Timeseries models forecast steps ahead; anomaly detectors additionally report anomaly counts and score statistics; all other models run standard predict.

Parameters

model_id
str
Identifier of a trained model from tuiml_train (arrives via **kwargs, like all parameters below). One of model_id / model_path is required.
model_path
str = None
Explicit path to a serialized model file.
data
str
Dataset to predict on (dataset_id, file path, or built-in name). Not needed for timeseries forecasting.
stage
str = None
Optional stage: 'forecast' (timeseries) or 'predict_proba' (class probabilities). When None, dispatch is based on model tags.
stage_kwargs
dict = None
Extra stage arguments (e.g. steps for forecasting).
steps
int = 10
Number of future steps to forecast for timeseries models.
output_path
str = None
When given, predictions are also written to this file.

Returns

result
dict
On success: status ('success'), num_predictions, predictions_preview (first 10), and optionally model_type, steps, output_path; anomaly models add n_anomalies, n_normal, anomaly_ratio, anomaly_scores_preview and score_stats. On failure: status ('error'), error, error_type and optionally suggestion.