API Reference / cli /

preprocess.py

Preprocess Command - Run preprocessing pipelines and atomic stages.

Functions

Func

parse_extra_args

Line 7
parse_extra_args(args)

Parse leftover command-line arguments into a keyword dictionary.

Each flag is stripped of its leading dashes and paired with the token that follows it, coerced to a bool, int or float where possible. A flag with no value of its own becomes True.

Parameters

args
list of str
Unparsed command-line tokens, e.g. ['--kfold', '10', '--strategy', 'mean', '--cv'].

Returns

kwargs
dict
Parsed keyword arguments, e.g. {'kfold': 10, 'strategy': 'mean', 'cv': True}.
Command

tuiml preprocess

Line 75
tuiml preprocess [OPTIONS]

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

Runs either a pipeline of named preprocessing steps or one atomic stage: split, impute, balance, scale, encode or discretize. The target column is held out while the features are transformed and re-appended to the result. Any option this command does not recognise is forwarded to the stage as a keyword argument, so stage-specific settings such as --kfold 10 can be given inline.

Run a preprocessing pipeline over a built-in dataset:

bash
$ tuiml preprocess --data iris --steps '["StandardScaler"]'

Impute missing values and write the result to a file:

bash
$ tuiml preprocess --data data.csv --stage impute --output clean.csv

Forward a stage-specific option to the split stage:

bash
$ tuiml preprocess --data data.csv --stage split --kfold 10

Options

--data
str required
Data file path or built-in dataset name
--target
str
Target column name (excluded from preprocessing, re-appended to output)
--steps
str
Preprocessing steps as a JSON array of class names, or of objects carrying their own params, e.g. '["SimpleImputer", "StandardScaler"]'
--stage
str
Run a single atomic stage instead of a pipeline: 'split', 'impute', 'balance', 'scale', 'encode' or 'discretize'
--output
str
Path to write the preprocessed file(s) to
--save-as
str
Alias for --output; ignored when --output is given
--json-output
flag
Output raw JSON