Bin Feature
bin_featureConvert a numerical column into bins using quantile, uniform, or custom edges learned from training rows, with open-ended first and last bins so unseen test values still map to a bin.
Instructions
Turn a numerical column into bins (e.g. age -> age groups). Bin edges are learned from the training rows only; the first and last bins are open-ended so unseen test values still fall in a bin. Args: dataset_id (str): ID of a dataset or of a split. column (str): Numerical column to bin. bins (int): Number of bins for "quantile" and "uniform", 2 to 50. Default is 5. strategy (str): "quantile" (equal-sized groups), "uniform" (equal-width bins) or "custom". Default is "quantile". edges (list[float], optional): Required for "custom". The inner boundaries, e.g. [18, 65] makes three bins: <=18, 18-65 and >65. Bins include their upper boundary. labels (list[str], optional): Names for the bins (one per bin). If omitted, bins are numbered 0, 1, 2, ... new_column (str, optional): Name of the new column. Default is "_bin". drop_original (bool): Drop the original column. Default is False. Returns: dict: The inner edges used, the number of bins and how many training rows fall in each bin.
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>",
"column": "<column>"
},
"name": "bin_feature"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bins | No | ||
| edges | No | ||
| column | Yes | ||
| labels | No | ||
| strategy | No | quantile | |
| dataset_id | Yes | ||
| new_column | No | ||
| drop_original | No |