Skip to content

Main content

Ordinal Label Cost Matrix Cell Tool

Compute ordinal label cost matrix cell from explicit bounded inputs.

Loading tool…

Description

Return ordinal class error cost.

Ordinal labels have an order, but adjacent categories need not be equally spaced measurements. Index distances, cumulative targets and weighted medians preserve a specified ordering while probability normalization, equality at a median boundary and distance costs remain distinct conventions.

Return ordinal class error cost.

When to use this tool

Use Ordinal Label Cost Matrix Cell when evaluating the stated ordered-label target, distance or mass convention.

How to use the tool and how it works

  1. Enter actual, predicted, classes, squared. 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 cost. Use the output convention below.

Return ordinal class error cost. Require classes >= 2 and valid actual/predicted indexes; d = abs(actual-predicted), cost = d² when squared, otherwise d.1

Input fieldMeaning and unitsAccepted input
actualActualRequired. Safe integer; minimum 0.
predictedPredictedRequired. Safe integer; minimum 0.
classesClassesRequired. Safe integer; minimum 2; maximum 1000000.
squaredSquaredRequired. Boolean.
Output fieldInterpretationReturned shape
costCostRequired. Finite number.
json
{
  "input": {
    "actual": 1,
    "predicted": 4,
    "classes": 5,
    "squared": true
  },
  "output": {
    "cost": 9
  }
}

Limitations and assumptions

  • This assumes index-based spacing/cost and does not validate meaningful distances between real class labels.
  • 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 meaningful ordered labels and an appropriate ordinal model; evaluate prediction quality with costs and probability assumptions justified for the actual categories.

References

  1. Calculation and input contract: classification/ordinal-label-cost-matrix-cell — tool.io

Similar or alternative tools