Compare Models
compare_modelsTrain and rank multiple candidate models on the same train/test split, then return a leaderboard with stored models and metrics to select a winner for tuning.
Instructions
Train several candidate models on the same split, score them all on the same train and test data, and return a ranked leaderboard. The trained models are stored (model_id) so you can plot or inspect them. The split must have only numerical, complete features (run encode_categorical / impute_missing first). Each model uses the default settings of its own training tool; tune the winner afterwards. Args: split_id (str): ID of a split made by train_test_split. models (list[str], optional): Training tool names to try, e.g. ["ridge_regression","random_forest_regressor"]. Default: linear, ridge, lasso, decision tree, random forest, gradient boosting and xgboost (regression); logistic, knn, decision tree, random forest, svm, gradient boosting and xgboost (classification). elastic_net is available but not tried by default. Models whose package is missing are skipped and listed. task (str): "auto" (inferred from the target), "regression" or "classification". Default is "auto". sort_by (str, optional): Metric that ranks the models, measured on the test data. Regression: r2 (default), mae, mse, rmse, mape_percent. Classification: f1 (default), accuracy, balanced_accuracy, precision, recall, roc_auc, f1_macro (multiclass only). include_slow (bool): Also run SVM on large data (over 10,000 training rows). Default is False. keep (str): "all" keeps every trained model; "best" deletes all but the winner (less clutter). Default is "all". Returns: dict: leaderboard (rank, model_id, algorithm, test score on sort_by, full train/test metrics, generalisation gap, training seconds), best_model_id, failed/skipped models, and notes (ties, overfitting, imbalance).
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": {
"split_id": "<split_id>"
},
"name": "compare_models"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keep | No | all | |
| task | No | auto | |
| models | No | ||
| sort_by | No | ||
| split_id | Yes | ||
| include_slow | No |