train_test_split
Split a dataframe into train and test sets for model validation. Preserve class proportions with stratify, and ensure reproducibility with a fixed random_state.
Instructions
Split dataframe into train/test sets. Stores them as '{name}_train' and '{name}_test'. stratify=True preserves target class proportions (classification only). Run BEFORE training any model. Always use fixed random_state for reproducibility. Use stratify=True for imbalanced classification datasets. Example: train_test_split(target_column="Revenue", test_size=0.2)
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": {
"target_column": "<target_column>"
},
"name": "train_test_split"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| df_name | No | ||
| stratify | No | ||
| test_size | No | ||
| random_state | No | ||
| target_column | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |