Principle:DistrictDataLabs Yellowbrick Type Introspection
| Knowledge Sources | |
|---|---|
| Domains | Model_Evaluation, Utilities |
| Last Updated | 2026-02-08 05:00 GMT |
Overview
Principle of runtime detection of estimator types and capabilities to enable dynamic dispatch of visualization logic.
Description
Machine learning visualizers need to adapt their behavior based on the type of model provided (classifier, regressor, clusterer) and its capabilities (probabilistic predictions, grid search). Type introspection inspects _estimator_type attributes, class hierarchies, and method availability to make these determinations, supporting both native sklearn estimators and wrapped third-party models.
Usage
Use this principle when building visualizers that need to dispatch behavior based on the type of estimator, or when validating estimator compatibility before visualization.
Theoretical Basis
Type Detection Strategy:
Pseudo-code Logic:
# Abstract algorithm
def detect_type(estimator):
if hasattr(estimator, '_estimator_type'):
return estimator._estimator_type
if issubclass(type(estimator), ClassifierMixin):
return 'classifier'
if has_method(estimator, 'predict_proba'):
return 'probabilistic'