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:DistrictDataLabs Yellowbrick ContribEstimatorWrapper

From Leeroopedia


Knowledge Sources
Domains Model_Evaluation, Utilities
Last Updated 2026-02-08 05:00 GMT

Overview

Wrapper utilities for adapting third-party estimators that implement the sklearn API but do not subclass BaseEstimator for use with Yellowbrick visualizers.

Description

The contrib.wrapper module provides the ContribEstimator proxy class and convenience functions wrap, classifier, regressor, and clusterer. These wrap any object implementing the sklearn API (fit/predict/score) so Yellowbrick can correctly identify it as a classifier, regressor, or clusterer.

Usage

Import wrap or the type-specific functions when using third-party ML libraries (e.g., XGBoost, LightGBM without sklearn wrappers) with Yellowbrick visualizers.

Code Reference

Source Location

Signature

def wrap(estimator, estimator_type=None):
    """Wraps a third-party estimator for Yellowbrick compatibility."""

def classifier(estimator):
    """Wraps estimator as a classifier."""

def regressor(estimator):
    """Wraps estimator as a regressor."""

def clusterer(estimator):
    """Wraps estimator as a clusterer."""

class ContribEstimator:
    def __init__(self, estimator, estimator_type=None):
        """Proxy class for third-party estimators."""

    def __getattr__(self, attr):
        """Proxies attribute access to wrapped estimator."""

Import

from yellowbrick.contrib.wrapper import wrap, classifier, regressor, clusterer

I/O Contract

Inputs

Name Type Required Description
estimator object Yes Third-party estimator with fit/predict/score
estimator_type str No "classifier", "regressor", or "clusterer"

Outputs

Name Type Description
wrapped ContribEstimator Yellowbrick-compatible proxy estimator

Usage Examples

from yellowbrick.contrib.wrapper import classifier
from yellowbrick.classifier import ROCAUC

# Wrap a third-party classifier
import xgboost as xgb
model = classifier(xgb.XGBClassifier())

viz = ROCAUC(model)
viz.fit(X_train, y_train)
viz.score(X_test, y_test)
viz.show()

Related Pages

Page Connections

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