Skip to main content
Glama

三域医研 · 科研算法引擎 (SanYu Research Engine)

特征重要性(随机森林)

act_feature_importance
Read-only

特征重要性(随机森林) 有一堆候选变量,想按重要性排序、筛出真正该进模型的那几个 各特征的随机森林重要性(不纯度下降,sum=1)、按重要性排序、树数、随机种子(random_state=42,可复现);同传 feature_names 时直接返回真实变量名。注意这是模型内重要性不是因果效应:高重要性不代表干预该变量能改变结局。

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": {
      "X": "<X>",
      "y": "<y>"
    },
    "name": "act_feature_importance"
  }
}

Input Schema

NameRequiredDescriptionDefault
XYes特征矩阵,**二维数组 [[1.2,30],[0.8,41],...]**,每行一个样本、每列一个特征;也接受一维数组(视为单个特征)。**不接受对象/字典形式**(想传 {变量名:[值]} 请先自己转成二维数组)。**不接受缺失值**:含 NaN/Inf 会直接 400 并指向 MICE 插补接口 —— 随机森林不会替你猜缺失。
yYes结局标签,与 X 的行数等长。恰有 2 个不同取值时按**二分类**建森林,否则按**回归**;分类/回归会自动判定并在返回里标明 (task),不用你指定。
n_treesNo树的数量,默认 100。**服务端钳制在 10~500**:超出范围不报错,但返回里 n_trees_clamped=true 并给出实际用的 n_trees。树越多越稳定也越慢。
feature_namesNo可选,与 X 列数等长的变量名数组,如 ["age","sex","crp"]。不传则返回 X1..Xp 的列位置编号 —— **写论文时务必传**,否则读者不知道哪个变量重要。长度与列数不符时自动退回列位置编号。

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • changedInput schema / properties / X / description
      Previous value: -"特征矩阵,每行一例、每列一个特征"New value: +"特征矩阵,**二维数组 [[1.2,30],[0.8,41],...]**,每行一个样本、每列一个特征;也接受一维数组(视为单个特征)。**不接受对象/字典形式**(想传 {变量名:[值]} 请先自己转成二维数组)。**不接受缺失值**:含 NaN/Inf 会直接 400 并指向 MICE 插补接口 —— 随机森林不会替你猜缺失。"
    • addedInput schema / properties / feature_names
      Added value: +{
      +  "description": "可选,与 X 列数等长的变量名数组,如 [\"age\",\"sex\",\"crp\"]。不传则返回 X1..Xp 的列位置编号 —— **写论文时务必传**,否则读者不知道哪个变量重要。长度与列数不符时自动退回列位置编号。",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • changedInput schema / properties / n_trees / description
      Previous value: -"树的数量,默认 100"New value: +"树的数量,默认 100。**服务端钳制在 10~500**:超出范围不报错,但返回里 n_trees_clamped=true 并给出实际用的 n_trees。树越多越稳定也越慢。"
    • changedInput schema / properties / y / description
      Previous value: -"标签,长度须等于 X 的行数"New value: +"结局标签,与 X 的行数等长。恰有 2 个不同取值时按**二分类**建森林,否则按**回归**;分类/回归会自动判定并在返回里标明 (task),不用你指定。"
  2. Added

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already establish that this is a safe read-only, closed-world computation, so the description is not required to repeat that. It adds behavior the annotations cannot: importance values sum to 1, output is sorted by importance, seed 42 makes results reproducible, and column-index names are used when feature_names is missing. The closing warning that this is model-internal importance and not a causal effect is genuinely useful interpretive guidance that goes beyond structured fields.

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

Conciseness4/5

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

The purpose and output summary are front-loaded in a short block, and every clause earns its place, including the causal caveat. It is dense with parallel clauses rather than cleanly separated sentences, which makes it slightly harder to scan but does not waste words.

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?

For a read-only scoring tool with no output schema, the description covers what comes back (importance values summing to 1, sorted order, tree count, task/seed), how naming works, and how to interpret the numbers. The only omission is a note on how the results should be read or paginated, which is minor for a single-call computation.

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

Parameters3/5

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

Schema coverage is 100%, so all four parameters, including the NaN/Inf rejection, the 10-500 n_trees clamp, and the binary-vs-regression auto-detection, are already documented in the schema. The description restates a few of these (seed 42, feature_names fallback) without adding format or semantic detail beyond the schema, so the baseline 3 applies.

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?

The description names the exact resource and method ('随机森林重要性(不纯度下降, sum=1)') and frames the job as ranking and screening candidate variables for a model. That distinguishes it clearly from the statistical-test and charting siblings, which do not produce model-based importance scores.

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?

It gives a concrete trigger scenario ('有一堆候选变量,想按重要性排序、筛出真正该进模型的那几个'), which is a usable when-to-use condition. No alternative tool is named for the case where causal inference, not screening, is wanted, but the caveat sentence partly covers that gap.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.