Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Scikit learn Scikit learn MultiOutputClassifier

From Leeroopedia


Knowledge Sources
Domains Machine Learning, Multi-Output Learning, Meta-Estimators
Last Updated 2026-02-08 15:00 GMT

Overview

Concrete meta-estimator for multi-output regression and classification provided by scikit-learn.

Description

The multioutput module provides meta-estimators that extend single-output estimators to handle multi-output problems. MultiOutputClassifier fits one classifier per output, MultiOutputRegressor fits one regressor per output, and ClassifierChain/RegressorChain chain estimators to exploit correlations between outputs. These support parallel fitting and metadata routing.

Usage

Use these meta-estimators when you need to predict multiple target variables simultaneously and your base estimator only supports single-output prediction. Chain variants are preferred when outputs are correlated.

Code Reference

Source Location

Signature

class MultiOutputRegressor(RegressorMixin, MetaEstimatorMixin, BaseEstimator):
    def __init__(self, estimator, *, n_jobs=None):
        ...

class MultiOutputClassifier(ClassifierMixin, MetaEstimatorMixin, BaseEstimator):
    def __init__(self, estimator, *, n_jobs=None):
        ...

class ClassifierChain(MetaEstimatorMixin, ClassifierMixin, BaseEstimator):
    def __init__(self, base_estimator, *, order=None, cv=None, random_state=None):
        ...

class RegressorChain(MetaEstimatorMixin, RegressorMixin, BaseEstimator):
    def __init__(self, base_estimator, *, order=None, cv=None, random_state=None):
        ...

Import

from sklearn.multioutput import (
    MultiOutputClassifier,
    MultiOutputRegressor,
    ClassifierChain,
    RegressorChain,
)

I/O Contract

Inputs

Name Type Required Description
estimator estimator instance Yes Base estimator to fit per output
X array-like of shape (n_samples, n_features) Yes Training input samples
y array-like of shape (n_samples, n_outputs) Yes Multi-output target values
n_jobs int No Number of parallel jobs for fitting

Outputs

Name Type Description
predictions ndarray of shape (n_samples, n_outputs) Predicted values for each output
estimators_ list List of fitted estimators, one per output

Usage Examples

Basic Usage

from sklearn.multioutput import MultiOutputClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import make_multilabel_classification

X, y = make_multilabel_classification(n_samples=100, n_classes=3, random_state=42)
clf = MultiOutputClassifier(RandomForestClassifier(random_state=42))
clf.fit(X, y)
predictions = clf.predict(X)
print(predictions.shape)  # (100, 3)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment