Multi-Label Classification โ€” Auto-Tagging Content and Catalogs

Tags, labels, and categories are rarely exclusive: a product is fresh and fruit, a document is contract and expiring. Multi-label classification scores every label independently โ€” and it's built into Aito v2 as a query: the prediction target selects the mode. predict "tags" scores whole tag-sets exclusively; predict "tags.$feature" scores each member label on its own โ€” the multi-label form.

Score each label independently

{
  "from": "products",
  "where": { "name": { "$match": "milk" } },
  "predict": "tags.$feature",
  "select": ["$value", "$p"],
  "limit": 5
}

Each hit is one candidate label with its own probability P(tags has label | evidence) โ€” no forced ranking against sibling labels, so a row can confidently carry three tags or none. Threshold per label ($p > 0.5 โ†’ apply), or take top-k as suggestions for a human to confirm.

From free text, at ingest time

The evidence can be any mix of text, categorical, and numeric fields. A typical auto-tagging flow: new item arrives โ†’ one _predict call โ†’ apply the confident labels, queue the rest:

{
  "from": "products",
  "where": {
    "name": { "$match": "fullcorn rye bread" },
    "price": { "$numeric": 1.3 }
  },
  "predict": "tags.$feature",
  "select": ["$value", "$p", "$why"],
  "limit": 10
}

$why shows which evidence drove each label โ€” the difference between a suggestion an editor trusts and one they re-check.

Measure label quality

Run a train/test split over your existing tagged rows before switching on auto-apply:

{
  "test": { "$sample": 25 },
  "evaluate": {
    "from": "invoices",
    "where": { "Description": { "$get": "Description" } },
    "predict": "GLCode"
  },
  "select": ["accuracy", "baseAccuracy", "meanRank", "n"]
}

See the Evaluation guide for sampling selectors and reading the metrics.

Why Aito for this

  • The target picks the semantics. predict X = exclusive single-label, predict X.$feature = independent multi-label. No flag to misconfigure โ€” a contradictory legacy exclusiveness flag is rejected loudly.
  • No per-label models. One query scores the whole label vocabulary, computed from the live rows โ€” add a new label by tagging a few examples.
  • Duplicate values aggregate. Candidates are values, not rows: a label that appears on a thousand rows is one candidate with the aggregated probability.

Related: Query Reference ยท Inference guide ยท Sandbox

โ† All v2 use cases