← Назад в Академию
A librarian holds sailboat and compass subject cards as a student places a blue ocean-themed book in one shelf slot.
Знания об ИИЯдро7 нояб. 2026 г.· 3 мин

Multiclass and Multilabel Predictions

Multiclass prediction assigns one label per record while multilabel prediction allows several, and this lesson uses library shelving and subject tags to show why exact-match accuracy can hide partial correctness.

multiclass vs multilabelexact-match accuracylibrary classification activity

Источники

Полное резюме урока

A school library stamps one shelf code on the spine of each book, but the same book can carry any number of subject tags. A novel might sit at J-FIC while the catalog lists it under adventure, friendship and sailing. The shelf code is a single choice from a fixed list. The tags are a set that can be empty or hold several entries. This small arrangement gives teachers, families and students a concrete way into two prediction tasks that are easy to confuse.

In multiclass prediction, each record receives exactly one label from a list of three or more. Our book has one shelf location, and the model must choose among, say, J-FIC, J-SCI and J-HIS. In multilabel prediction, each record can receive any number of binary labels at once. The model decides separately for adventure, friendship and sailing, so it may say yes to two and no to the third. A practical tool called MultiLabelBinarizer turns a list such as {adventure, sailing} into a row of ones and zeros, one column per subject. The source material describes this as multiple targets with two possible values each, zero or one.

A single record looks different in each setting. In multiclass, a prediction is one shelf, such as J-SCI. In multilabel, a prediction is a set of tags, such as {adventure, sailing}. An error differs too. A wrong shelf is a single mistake, but a tag set can be partly right. Suppose the true tags are {adventure, friendship, sailing} and the model returns {adventure, sailing}. The record is not fully correct, yet two of three tags match. Missing labels are allowed, and an empty tag set is a legitimate answer for a book with no listed subjects.

Exact-match accuracy can mislead when it scores a tag set as correct only if it matches the true set perfectly. The book above counts as wrong. A model that predicts {adventure, sailing} for many books may look weak on exact match even though it captures useful subjects. Partial measures such as how many predicted tags are correct, or how many true tags were found, tell a fuller story. Neither measure is inherently better. Each answers a different question about the same predictions.

A book could carry exactly one subject tag, making the task look like multiclass. It is still multilabel, because the format permits several tags and permits none. Treating it as multiclass would force a choice the data does not require. An unannotated tag is not the same as a confirmed negative. If the catalog simply omits a subject, we cannot assume the book is not about that subject.

For a classroom task, give pairs a set of eight invented book cards with shelf codes and subject tags. Ask each pair to write predictions for four cards, then swap with another pair. The receiving pair marks every tag as found, missed or extra, and writes one sentence explaining whether exact match is a fair score here. Post the sentences on a board so the reasoning behind each judgment is visible. A short dialogue helps. "You called it wrong." "It missed friendship but found adventure and sailing. Let us show both scores and decide which one matters for our shelf."