Principle:Scikit learn Scikit learn Multiclass Multioutput
| Knowledge Sources | |
|---|---|
| Domains | Supervised Learning, Classification |
| Last Updated | 2026-02-08 15:00 GMT |
Overview
Multiclass and multioutput strategies extend binary classifiers to handle problems with more than two classes or multiple simultaneous prediction targets.
Description
Many real-world problems require predicting more than two classes, predicting multiple labels simultaneously, or producing multiple output values. Multiclass strategies decompose a multi-class problem into multiple binary classification sub-problems, enabling binary-only classifiers to handle multi-class tasks. Multioutput strategies handle problems where each sample has multiple target variables. These meta-strategies solve the problem of adapting the large collection of binary classifiers to richer prediction tasks, providing a modular approach where any binary classifier can be extended. They form the bridge between binary classification algorithms and the diverse prediction tasks encountered in practice.
Usage
Use One-vs-Rest (OvR) for multiclass classification when you want to train one binary classifier per class and the classes are mutually exclusive. OvR is the most common strategy and works well when the number of classes is moderate. Use One-vs-One (OvO) when the base classifier scales poorly with dataset size, since each sub-problem uses a smaller subset of data. Use MultiOutputClassifier when each sample has multiple independent target labels and you want to train a separate classifier for each target. Use MultiOutputRegressor for the analogous regression case. Use ClassifierChain or RegressorChain when the targets are correlated and you want to model these dependencies.
Theoretical Basis
One-vs-Rest (OvR): For classes, train binary classifiers, one for each class against all others:
- Classifier : Relabels class as positive and all other classes as negative.
- Prediction: , where is the decision function of classifier .
- The approach produces classifiers, each trained on the full dataset.
One-vs-One (OvO): Train a binary classifier for each pair of classes:
- Number of classifiers:
- Prediction: Each classifier votes for one of its two classes; the class with the most votes wins.
- Each classifier is trained on only the samples from the two relevant classes, making individual problems smaller.
MultiOutput: For target variables, train independent estimators:
- Classifier predicts target independently.
- Prediction:
- Assumes targets are independent, which simplifies the problem but ignores correlations.
Classifier Chain: Addresses target dependencies by chaining classifiers:
- Order the targets .
- Classifier predicts using the original features augmented with the predictions of all previous classifiers:
- This models conditional dependencies between targets.
Multilabel classification is a special case of multioutput where each target is binary (indicating presence or absence of a label). A sample can have zero, one, or multiple active labels simultaneously.