Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:DistrictDataLabs Yellowbrick Type Detection Utilities

From Leeroopedia


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

Overview

Detection utilities for identifying scikit-learn estimator types including classifiers, regressors, clusterers, grid searches, and probabilistic models.

Description

The utils.types module provides functions to determine the type of a scikit-learn estimator. Each function handles both standard sklearn estimators and ContribEstimator wrappers for third-party models. Functions use a combination of class inspection, _estimator_type attributes, and method checking (e.g., predict_proba for probabilistic estimators). Lowercase aliases (isestimator, isclassifier, etc.) are provided for backwards compatibility.

Usage

Import these utilities when building visualizers that need to dispatch behavior based on estimator type, or when validating that an appropriate estimator type was provided.

Code Reference

Source Location

Signature

def is_estimator(model): ...
def is_classifier(estimator): ...
def is_regressor(estimator): ...
def is_clusterer(estimator): ...
def is_gridsearch(estimator): ...
def is_probabilistic(estimator): ...

# Backwards-compatible aliases
isestimator = is_estimator
isclassifier = is_classifier
isregressor = is_regressor
isclusterer = is_clusterer
isgridsearch = is_gridsearch

Import

from yellowbrick.utils.types import (
    is_estimator, is_classifier, is_regressor, is_clusterer,
    is_gridsearch, is_probabilistic,
)

I/O Contract

Inputs

Name Type Required Description
estimator object Yes Object to check type of

Outputs

Name Type Description
result bool True if estimator matches the type

Usage Examples

from sklearn.svm import SVC
from sklearn.linear_model import LinearRegression
from yellowbrick.utils.types import is_classifier, is_regressor, is_probabilistic

model = SVC(probability=True)
print(is_classifier(model))     # True
print(is_regressor(model))      # False
print(is_probabilistic(model))  # True

reg = LinearRegression()
print(is_regressor(reg))        # True

Related Pages

Page Connections

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