Select Features
select_featuresRanks numerical features by model importance and drops weak ones, with options to keep top k or above a threshold and optionally only report the ranking.
Instructions
Model-based feature selection: fit a model on the training rows, rank the numerical features by importance and drop the weak ones. (feature_selection in preprocessing uses simple statistical filters instead.) Only numerical features are scored; other columns are kept untouched. Missing values must be imputed first. Args: dataset_id (str): ID of a dataset or of a split. With a split the target is known already. target_column (str, optional): Required when dataset_id is a dataset. method (str): "random_forest" (importance from a random forest) or "lasso" (L1 regularisation, regression only). Default is "random_forest". k (int, optional): Keep the k most important features. threshold (float, optional): Keep features whose normalised importance (importances sum to 1) is at least this value. If neither k nor threshold is given: random_forest keeps features above the average importance, lasso keeps non-zero ones. apply (bool): Drop the unselected features. If False, only report the ranking. Default is True. random_state (int): Seed. Default is 42. Returns: dict: Ranked importances, the selected and dropped features, and whether the data was changed.
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>"
},
"name": "select_features"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| k | No | ||
| apply | No | ||
| method | No | random_forest | |
| threshold | No | ||
| dataset_id | Yes | ||
| random_state | No | ||
| target_column | No |