Description
Yellowbrick has hand-rolled functions is_classifier(), is_regressor(), and is_clusterer(), defined in yellowbrick/utils/types.py, do not work with sklearn 1.8.
Scikit-Learn 1.8 removed the attribute _estimator_type on all mixin classes: ClassifierMixin, RegressorMixin, ClusterMixin, DensityMixin, and OutlierMixin. This breaks the introspection method used by Yellowbrick's functions is_classifier() and friends.
To reproduce
uv pip install scikit-learn>=1.8.0 yellowbrick
from sklearn.svm import SVC # or any other classifier
from yellowbrick.classifier import classification_report
from yellowbrick.datasets import load_bikeshare
X, y = load_bikeshare()
vis = classification_report(SVC(), X, y)
Traceback
File /opt/conda/lib/python3.12/site-packages/yellowbrick/classifier/base.py:122, in ClassificationScoreVisualizer.__init__(self, estimator, ax, fig, classes, encoder, is_fitted, force_model, **kwargs)
109 def __init__(
110 self,
111 estimator,
(...) 119 ):
120 # A bit of type checking
121 if not force_model and not isclassifier(estimator):
--> 122 raise YellowbrickTypeError(
123 "This estimator is not a classifier; "
124 "try a regression or clustering score visualizer instead!"
125 )
127 # Initialize the super method.
128 super(ClassificationScoreVisualizer, self).__init__(
129 estimator, ax=ax, fig=fig, is_fitted=is_fitted, **kwargs
130 )
YellowbrickTypeError: This estimator is not a classifier; try a regression or clustering score visualizer instead!
Fix
The fix is trivial: simply remove Yellowbrick's implementations if is_classifer() and friends and instead import these functions from sklearn.base.
Affected package versions
- Scikit-Learn 1.8.0
- Yellowbrick 1.5
Implication
The Yellowbrick project no longer works at all with the latest version of its primary dependency. Unless a new Yellowbrick version is released that fixes this, the project is effectively dead. This is a pity, because Yellowbrick is a nicely designed little library and could be more relevant today than ever.
Description
Yellowbrick has hand-rolled functions
is_classifier(),is_regressor(), andis_clusterer(), defined inyellowbrick/utils/types.py, do not work with sklearn 1.8.Scikit-Learn 1.8 removed the attribute
_estimator_typeon all mixin classes:ClassifierMixin,RegressorMixin,ClusterMixin,DensityMixin, andOutlierMixin. This breaks the introspection method used by Yellowbrick's functionsis_classifier()and friends.To reproduce
uv pip install scikit-learn>=1.8.0 yellowbrickTraceback
Fix
The fix is trivial: simply remove Yellowbrick's implementations if
is_classifer()and friends and instead import these functions fromsklearn.base.Affected package versions
Implication
The Yellowbrick project no longer works at all with the latest version of its primary dependency. Unless a new Yellowbrick version is released that fixes this, the project is effectively dead. This is a pity, because Yellowbrick is a nicely designed little library and could be more relevant today than ever.