Skip to content

Main content

Top Two Score Relative Gap Tool

Normalize the two greatest supplied scores’ separation by absolute top score, preserving signed-score inputs.

Loading tool…

Description

Return top-two scores and their relative gap.

Classification scores rank labels or locate a prediction relative to a chosen decision boundary. Raw scores and logits need not be calibrated probabilities; exact ties, score direction and inclusion of boundary values are separate policy choices that can change the reported decision.

Return top-two scores and their relative gap.

When to use this tool

Use Top Two Score Relative Gap when checking the stated score comparison, tie or decision-band policy.

How to use the tool and how it works

  1. Enter scores. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read top, second, relativeGap, defined. Inspect defined before interpreting the associated values.

Return top-two scores and their relative gap. Require at least two scores; sort descending, relativeGap = (top-second)/abs(top) when top != 0, otherwise zero with defined false.1

Input fieldMeaning and unitsAccepted input
scoresScoresRequired. Array of finite number; maximum items 256.
Output fieldInterpretationReturned shape
topTopRequired. Finite number.
secondSecondRequired. Finite number.
relativeGap(top-second)/abs(top) when top is nonzero; zero placeholder otherwise, even for a negative runner-up.Required. Finite number.
definedReporting flag under the explicit denominator or information policy above; inspect any zero placeholder or policy-defined value.Required. Boolean.
json
{
  "input": {
    "scores": [
      2,
      5,
      3
    ]
  },
  "output": {
    "top": 5,
    "second": 3,
    "relativeGap": 0.4,
    "defined": true
  }
}

Limitations and assumptions

  • Scores need not be probabilities; a relative gap does not establish calibrated confidence or decision reliability.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Use a complete evaluation dataset and an explicit decision policy to assess performance; fit and validate calibration separately when a probability interpretation is required.

References

  1. Calculation and input contract: classification/top-two-score-relative-gap — tool.io

Similar or alternative tools