skordinal#

skordinal is a scikit-learn compatible library for ordinal classification, the supervised task whose class labels have a natural order but no known distance between them, such as a rating from poor to excellent or a disease graded from I to IV.

A nominal classifier ignores that order, so confusing poor with excellent costs it exactly as much as confusing poor with fair. The estimators here model the order instead, and the metrics score a prediction against it.

Every estimator follows the scikit-learn API, so it drops unchanged into Pipeline, GridSearchCV and the rest of the ecosystem. See Getting Started to install it and fit the first model, then Examples for worked examples.

At a glance#

Thirteen ordinal classifiers: threshold models (POM, LogisticAT, LogisticIT), neural networks (NNPOM, NNOP, ELMOP), kernel discriminants (KDLOR), support vector machines (REDSVM, SVOR), boosting (ORBoost) and three meta-estimators (OrdinalDecomposition, RegressorWrapper, CostSensitiveWrapper) that build an ordinal classifier out of an ordinary one.

Fourteen metrics spanning the ways an ordinal prediction can be judged: distance to the true class (MAE, AMAE, MMAE), exact and off-by-one accuracy and its complement the error rate (MZE), per-class sensitivity (MS, GMSEC and two more), agreement corrected for chance (weighted kappa), rank correlation (Kendall’s tau, Spearman’s rho) and the full predicted distribution (ranked probability score). All but the last are available as scikit-learn scorers through get_ordinal_scorer().

Datasets and an experiment harness: five bundled ordinal datasets, a loader for your own CSV files with reproducible resamples, and a Benchmark that fits every combination of model, dataset and resample and writes the aggregated results to disk.