8000 MNT remove unecessary isintance Pipeline (#21540) · thomasjpfan/scikit-learn@d128e79 · GitHub
[go: up one dir, main page]

Skip to content

Commit d128e79

Browse files
authored
MNT remove unecessary isintance Pipeline (scikit-learn#21540)
1 parent 39566fe commit d128e79

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

sklearn/inspection/_partial_dependence.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from scipy.stats.mstats import mquantiles
1414

1515
from ..base import is_classifier, is_regressor
16-
from ..pipeline import Pipeline
1716
from ..utils.extmath import cartesian
1817
from ..utils import check_array
1918
from ..utils import check_matplotlib_support # noqa
@@ -383,20 +382,11 @@ def partial_dependence(
383382
... grid_resolution=2) # doctest: +SKIP
384383
(array([[-4.52..., 4.52...]]), [array([ 0., 1.])])
385384
"""
385+
check_is_fitted(estimator)
386+
386387
if not (is_classifier(estimator) or is_regressor(estimator)):
387388
raise ValueError("'estimator' must be a fitted regressor or classifier.")
388389

389-
if isinstance(estimator, Pipeline):
390-
# TODO: to be removed if/when pipeline get a `steps_` attributes
391-
# assuming Pipeline is the only estimator that does not store a new
392-
# attribute
393-
for est in estimator:
394-
# FIXME: remove the None option when it will be deprecated
395-
if est not in (None, "drop"):
396-
check_is_fitted(est)
397-
else:
398-
check_is_fitted(estimator)
399-
400390
if is_classifier(estimator) and isinstance(estimator.classes_[0], np.ndarray):
401391
raise ValueError("Multiclass-multioutput estimators are not supported")
402392

0 commit comments

Comments
 (0)
0