Input
ExecutionExecution trigger that begins the ordinal evaluation
AI/ML/Ordinal
Evaluate predictions for an ordered target with distance-aware metrics. Plain accuracy is inadequate here: it treats "predicted high when the truth was medium" exactly as harshly as "predicted low", so a model that is reliably one level off scores like one that guesses. Quadratic weighted kappa is the standard headline metric because it weights every miss by how far off it was and corrects for chance agreement, but it answers only one of three questions: the linear kappa and the macro-averaged error say how far off the model is under a different cost structure and on the rare levels, while Kendall's tau-b and the Spearman correlation say whether it orders the rows correctly at all.
Scores range from 0 to 10. Higher values mean more impact, exposure, or operational weight.
Execution trigger that begins the ordinal evaluation
Database connection containing the predicted levels and the true levels
Column holding the predicted level of each row. The labels must be the same ones the actuals column uses, since both columns are ranked against one shared level order.
Column holding the true level of each row. When no Class Order is given, the level order is inferred from this column, and a predicted level that never occurs here is an error rather than a silent extra rank.
Comma-separated level labels from LOWEST to HIGHEST, e.g. `low, medium, high`. Leave empty when the levels are numeric and their numeric order is the order you want. Non-numeric labels have no inferable order (sorting them alphabetically would rank high < low < medium), so they have to be listed here.
Activated once the ordinal evaluation completes
Headline ordinal metric: chance-corrected agreement weighted by the squared level distance. 1.0 perfect, 0.0 chance, negative worse than chance.
The same chance-corrected agreement with every level of distance costing the same. Read this one instead of the quadratic kappa when a level is a level — grading scales, severity tiers, anything where two steps off is exactly twice as bad as one. Quadratic weighting charges a near miss only a quarter of a two-level miss, so it flatters a model that merely hovers next to the truth; where that discount is not real, this is the honest number and it will be the lower of the two.
Average miss in levels. 0.0 is perfect, 1.0 means being off by one level on average.
The mean absolute rank error computed per true level and averaged with one vote per level. Look here whenever the levels are imbalanced: the plain error averages over rows, so the majority level speaks for the model and a predictor that collapses onto it still scores well while missing every rare level. This metric gives the rare levels equal weight, so it is the one that moves when that happens. Levels absent from the actuals are skipped rather than counted as perfect.
Share of predictions hitting the exact level. Reported for reference; it ignores how far the misses are off.
Share of predictions landing on the true level or one of its direct neighbours
Tie-corrected rank association: +1.0 orders the rows exactly as the truth does, 0.0 no association, -1.0 exactly backwards. This answers "does the model rank the rows correctly", which is a different question from "does it land on the right level" — a model whose every prediction is one level too high ranks perfectly and scores 1.0 here while the kappas drop. Consult it when the output feeds a sort, a triage queue or a threshold you can recalibrate, and read it against kappa to tell a miscalibrated model from a model that has learned nothing.
The same ordering question as tau-b, computed as a correlation on midranks. It is the less conservative of the two under the heavy ties ordinal data always has, so it reads higher than tau-b on the same predictions; prefer tau-b when you need a defensible figure and this one when comparing against Spearman values reported elsewhere. Like tau-b it ignores calibration entirely.
Number of rows evaluated
Number of distinct levels both columns were ranked against
All ordinal metrics plus the resolved level order they were computed against
Quadratic weighted kappa: agreement corrected for chance, with the penalty growing with the square of the level distance. 1.0 is perfect, 0.0 is chance, negative is worse than chance.
Linear weighted kappa: the same chance-corrected agreement with every level of distance costing the same. Lower than the quadratic figure whenever the misses are near misses.
Average distance between the predicted and the true level, measured in levels
Mean absolute rank error computed per true level and averaged with one vote per level, so the majority level cannot hide what the model does on the rare ones.
Share of predictions hitting the exact level (plain accuracy, for reference only)
Share of predictions landing on the true level or one of its neighbours
Kendall's tau-b: tie-corrected rank association. +1.0 orders the rows exactly as the truth does, 0.0 no association, -1.0 exactly backwards. Ignores calibration.
Spearman rank correlation on midranks: the same ordering question as tau-b on a different scale, and less conservative under heavy ties.
Number of rows evaluated
Number of distinct levels both columns were ranked against
The level labels from lowest to highest, in the rank order the metrics used
Whether that order came from the Class Order pin or from parsing the levels as numbers
Every distinct label parsed as a number, so the order is the numeric one.
The caller supplied the order explicitly.