API Reference / agent / tools / data /

preprocess.py

Preprocessing pipelines and stages.

Functions

Func

execute_preprocess

Line 11
execute_preprocess(**kwargs) -> Dict[str, Any]

Apply preprocessing steps or a specific atomic stage to a dataset.

Backs the tuiml_preprocess tool. Two modes: steps runs an ordered pipeline of named preprocessors; stage runs one atomic operation (split, impute, balance, scale, encode, discretize) with a default class per stage. Output is written to CSV so downstream tools can consume it by path.

Parameters

data
str
Dataset to preprocess: dataset_id, file path, or built-in name (arrives via **kwargs, like all parameters below).
steps
list = None
Pipeline mode: preprocessor steps, each a class name or {"name", **params} dict. One of steps / stage is required.
stage
str = None
Atomic stage mode: 'split', 'impute', 'balance', 'scale', 'encode', or 'discretize'.
stage_kwargs
dict = None
Stage options, e.g. method to pick a specific class, or for split: n_splits/kfold, test_size, train_size, shuffle, stratify, random_seed.
output
str = None
Output file or directory (alias: save_as); defaults to a temp location.
save_as
str = None
Alias for output.
target
str = 'target'
Column name for the label in the output CSV.
random_seed
int = None
Random seed forwarded to seed-aware stages.

Returns

result
dict
On success: status ('success'), original_shape, and either file_path, new_shape and steps_applied, or -- for stage='split' -- split_type ('kfold' / 'holdout') and files (train/test CSV paths, per fold for k-fold). On failure: status ('error'), error and optionally error_type / suggestion.