|
35 | 35 | from sklearn.discriminant_analysis import LinearDiscriminantAnalysis |
36 | 36 |
|
37 | 37 |
|
38 | | -from sklearn.base import (clone, ClassifierMixin, RegressorMixin, |
39 | | - TransformerMixin, ClusterMixin, BaseEstimator) |
| 38 | +from sklearn.base import (clone, TransformerMixin, ClusterMixin, |
| 39 | + BaseEstimator, is_classifier, is_regressor) |
40 | 40 | from sklearn.metrics import accuracy_score, adjusted_rand_score, f1_score |
41 | 41 |
|
42 | 42 | from sklearn.random_projection import BaseRandomProjection |
@@ -208,10 +208,10 @@ def _yield_clustering_checks(name, clusterer): |
208 | 208 | def _yield_all_checks(name, estimator): |
209 | 209 | for check in _yield_non_meta_checks(name, estimator): |
210 | 210 | yield check |
211 | | - if isinstance(estimator, ClassifierMixin): |
| 211 | + if is_classifier(estimator): |
212 | 212 | for check in _yield_classifier_checks(name, estimator): |
213 | 213 | yield check |
214 | | - if isinstance(estimator, RegressorMixin): |
| 214 | + if is_regressor(estimator): |
215 | 215 | for check in _yield_regressor_checks(name, estimator): |
216 | 216 | yield check |
217 | 217 | if isinstance(estimator, TransformerMixin): |
@@ -980,7 +980,7 @@ def check_estimators_partial_fit_n_features(name, estimator_orig): |
980 | 980 | X -= X.min() |
981 | 981 |
|
982 | 982 | try: |
983 | | - if isinstance(estimator, ClassifierMixin): |
| 983 | + if is_classifier(estimator): |
984 | 984 | classes = np.unique(y) |
985 | 985 | estimator.partial_fit(X, y, classes=classes) |
986 | 986 | else: |
|
0 commit comments