Train Test Split
train_test_splitSplits a dataset into training and test sets before preprocessing to prevent data leakage, and registers the split for use in encoding, scaling, and model training.
Instructions
Split a dataset into training and test sets and register them as a split. Do this BEFORE encoding, scaling or imputing, then pass the returned split_id to those tools so they are fit on the training data only (no data leakage). The original dataset is not changed. Args: dataset_id (str): ID of the dataset. target_column (str): Name of the target column. test_size (float): Fraction of rows used for testing (0 to 1). Default is 0.2. random_state (int): Seed for a reproducible split. Default is 42. stratify (bool): Keep the target class proportions in both sets (classification). Default is False. shuffle (bool): Shuffle the rows before splitting. Default is True. Returns: dict: split_id, row counts, feature columns and the inferred task.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"dataset_id": "<dataset_id>",
"target_column": "<target_column>"
},
"name": "train_test_split"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| shuffle | No | ||
| stratify | No | ||
| test_size | No | ||
| dataset_id | Yes | ||
| random_state | No | ||
| target_column | Yes |