Skip to main content
Glama

Logistic Regression

logistic_regression

Train a binary or multiclass logistic regression classifier on a prepared numerical split to get a baseline model, evaluation metrics, and top features for interpretation.

Instructions

Train a logistic regression classifier (binary or multiclass). A fast, interpretable baseline. The split must have only numerical, complete features (run encode_categorical / impute_missing first). Args: split_id (str): ID of a split made by train_test_split (stratify=True is advisable for classes). C (float): Inverse regularisation strength, greater than 0. Smaller values regularise more. Default is 1.0. max_iter (int): Maximum solver iterations. Default is 1000. fit_intercept (bool): Learn an intercept. Default is True. class_weight (str, optional): "balanced" re-weights classes inversely to their size (helps with imbalance). Default is None. scale (bool): Standardise the features first (recommended; makes coefficients comparable). Default is True. Returns: dict: model_id (use it in plots such as roc_curve), train/test metrics (accuracy, precision, recall, F1, ROC-AUC), top features and warnings (imbalance, overfitting, no better than the majority class).

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": "logistic_regression"
  }
}

Input Schema

NameRequiredDescriptionDefault
CNo
scaleNo
max_iterNo
split_idYes
class_weightNo
fit_interceptNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the load well: it discloses the preprocessing contract, that scaling is applied by default (affecting coefficient interpretability), and that the response includes model_id, train/test metrics, top features and warnings about imbalance/overfitting/majority-class baselines. It does not cover multiclass strategy (multinomial vs one-vs-rest) or cost/iteration implications, which remain gaps for a training tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded one-line purpose followed by clearly delimited Args and Returns blocks; each line adds information rather than restating the name. Defaults are repeated from the schema but are justified given zero schema description coverage.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, so the description correctly spells out the returned dict keys and even how to reuse model_id (roc_curve). Prerequisites are stated, but multiclass handling and expected runtime/scale limits are unaddressed for a six-parameter training tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, yet every one of the six parameters is explained with meaning, default and direction of effect (C as inverse regularisation, class_weight='balanced' semantics, scale making coefficients comparable). This is exactly the compensation the missing schema documentation requires.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Train a logistic regression classifier') plus task scope ('binary or multiclass') and a positioning claim ('fast, interpretable baseline'). An agent can distinguish it from linear_regression, ridge_regression, lasso_regression and decision_tree_classifier without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives concrete preconditions: the split must contain only numerical, complete features and encode_categorical / impute_missing must be run first, plus advice to use stratify=True in train_test_split. It does not explicitly say when to prefer this over sibling classifiers such as decision_tree_classifier or benchmark_models, so it stops short of full alternative routing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools