Optimize alert decision threshold

Choose a cost-sensitive alert action threshold using cross-validated decision curves and bootstrap net-benefit evidence against constant policies.

What it's for

Turns calibrated risk scores into an economically governed action policy instead of selecting an arbitrary probability cutoff.

What you give it

Every tool is a pure function: it computes from what you pass it and reads nothing on its own. Inputs split into evidence you supply from your connected systems, calibration your team owns, and numerical controls that affect precision but never the result's meaning.

Field Type Role Required
action_cost number ≥ 0 Your calibration Optional
bootstrap_draws integer ≥ 200, ≤ 20000 Numerical control Optional
candidate_thresholds array of number ≥ 1 item Evidence Optional
confidence_level number ≥ 0.8, ≤ 0.999 Your calibration Optional
cross_validation_folds integer ≥ 2, ≤ 20 Your calibration Optional
false_negative_cost number ≥ 0 Your calibration Yes
false_positive_cost number ≥ 0 Your calibration Yes
minimum_savings_per_case number ≥ 0 Your calibration Optional
resolved_predictions array of objects (4 fields) ≥ 100 items Evidence Yes
seed integer Numerical control Optional

Each resolved_predictions record

Field Type Required
id string (non-empty) Yes
outcome one of "0", "1" Yes
predicted_probability number (≥ 0, ≤ 1) Yes
weight number (> 0) Optional
Example input
{
  "action_cost": 2,
  "bootstrap_draws": 200,
  "candidate_thresholds": [
    0.1,
    0.2,
    0.5,
    0.9
  ],
  "false_negative_cost": 100,
  "false_positive_cost": 5,
  "resolved_predictions": [
    {
      "id": "resolved-alert-0",
      "outcome": 1,
      "predicted_probability": 0.85
    },
    {
      "id": "resolved-alert-1",
      "outcome": 0,
      "predicted_probability": 0.1
    },
    {
      "id": "resolved-alert-2",
      "outcome": 0,
      "predicted_probability": 0.1
    },
    {
      "id": "resolved-alert-3",
      "outcome": 0,
      "predicted_probability": 0.1
    },
    {
      "id": "resolved-alert-4",
      "outcome": 1,
      "predicted_probability": 0.85
    },
    {
      "id": "resolved-alert-5",
      "outcome": 0,
      "predicted_probability": 0.1
    },
    {
      "id": "resolved-alert-6",

Truncated for display — the full payload is 515 lines.

What you get back

This is the actual output of running the example above — computed by the same function the platform calls, not an illustration.

Example output
{
  "assumptions": [
    "Predicted probabilities and outcomes represent the same deployment population, and row weights encode that target population when supplied.",
    "False-positive, false-negative, and action costs are commensurable expected losses and do not omit material harms.",
    "The policy is selected only from prespecified thresholds; out-of-fold evaluation limits but does not eliminate adaptive-selection bias.",
    "Deployment requires calibrated probabilities, prospective monitoring, and human review wherever an alert affects a person or high-impact decision."
  ],
  "cost_implied_probability_threshold": 0.0667,
  "cross_validated_economics": {
    "best_constant_loss_per_case": 5.75,
    "best_constant_policy": "treat_all",
    "loss_per_case": 0.5,
    "minimum_required_savings_per_case": 0,
    "savings_interval": {
      "high": 5.7435,
      "low": 4.62
    },
    "savings_per_case": 5.25
  },
  "decision": "deploy_cost_sensitive_policy",
  "decision_curve": [
    {
      "action_rate": 0,
      "false_negative_rate_per_case": 0.25,
      "false_positive_rate_per_case": 0,
      "loss_per_case": 25,
      "policy": "treat_none",
      "threshold": null
    },
    {
      "action_rate": 1,
      "false_negative_rate_per_case": 0,
      "false_positive_rate_per_case": 0.75,
      "loss_per_case": 5.75,
      "policy": "threshold",
      "threshold": 0.1
    },
    {
      "action_rate": 0.25,
      "false_negative_rate_per_case": 0,
      "false_positive_rate_per_case": 0,
      "loss_per_case": 0.5,
      "policy": "threshold",
      "threshold": 0.2

Truncated for display — the full payload is 116 lines.

How it works

Constrained optimization — Pick the best feasible option under real limits — budget, headcount, dependencies, capacity — rather than ranking a list and hoping it fits.

  1. 1 Choose a cost-sensitive alert action threshold using cross-validated decision curves and bootstrap net-benefit evidence against constant policies.
  2. 2 Evaluate the method-specific diagnostics and gates returned by the function, then abstain unless the declared decision clears them under locally governed thresholds.

Before you trust it

Every tool in the catalog ships with the conditions under which its answer is meaningful — and the conditions under which it should abstain instead of guessing.

Assumptions & guardrails

  • Objectives use commensurable locally governed value units, constraints reflect real feasibility, and uncertainty covers plausible adverse inputs.
  • The recommendation is optimal only for its stated objective, feasible set, evidence, and solver guarantee; it is not a universal management optimum.

Minimum evidence

  • resolved_predictions: at least 100 rows/items
  • false_positive_cost: required and organization-defined
  • false_negative_cost: required and organization-defined

How to validate it

Backtest the chosen action against simple feasible baselines on held-out scenarios, sweep costs/constraints/risk tolerance, and require constraint feasibility under adverse inputs.

Calibrating it to your org

Same for everyone

The mathematical kernel, validation rules, method version, and JSON output semantics are organization-independent; no tenant-trained coefficients or company benchmark is embedded in the function.

Specific to you

  • predicted_probability joined to immutable resolution
  • false_positive_cost
  • false_negative_cost
  • action_cost

Calibration workflow

  1. 1 Define the management decision, target outcome, aggregate unit, privacy boundary, cadence, and prediction/intervention horizon for this organization.
  2. 2 Build a tenant-scoped historical cohort using only information available before each prediction or decision; preserve zero periods, censoring, assignment probabilities, and unresolved outcomes when the method requires them.
  3. 3 Estimate statistical parameters on training history, but obtain costs, utilities, risk tolerance, practical-effect thresholds, capacity, and policy constraints from accountable decision owners.
  4. 4 Validate on later time windows or held-out aggregate units at the deployment grain, against a simple baseline and the function-specific validation strategy.
  5. 5 Deploy only if the returned decision clears evidence, overlap, calibration, robustness, and guardrail checks; warning, unsupported, schema-gap, and fallback decisions are abstentions.
  6. 6 Monitor realized outcomes, data drift, coverage, and decision regret; recalibrate at a governed cadence or after a detected regime/definition change, never merely because a stakeholder dislikes the result.

Call it from your AI

You don't wire up 388 tools in your MCP client. The GitRevio MCP server exposes 20 tools, three of which let an agent search the catalog, read a tool's schema, and run it — so the assistant finds this one on its own.

gitrevio_capabilities_search
  { "q": "choose a costsensitive alert action threshold" }
  → finds "optimize_alert_decision_threshold"

gitrevio_capability_describe
  { "capability_id": "optimize_alert_decision_threshold" }
  → returns the input schema and agent guidance shown on this page

gitrevio_capability_run
  { "capability_id": "optimize_alert_decision_threshold", "arguments": { ... } }
  → returns the result shown above

Works in Claude Desktop, Claude Code, Cursor, Cline, Continue.dev, Goose and Aider. See the MCP server.

Related tools

See every tool in Measurement integrity →

Ready to See Your Engineering work clearly?