Return True if the given estimator is (probably) a classifier. Parameters ---------- estimator : estimator instance Estimator object to test. Returns ------- out : bool True if estimator is a classifier and False otherwise. Examples -------- >>>
(estimator)
| 1243 | |
| 1244 | |
| 1245 | def is_classifier(estimator): |
| 1246 | """Return True if the given estimator is (probably) a classifier. |
| 1247 | |
| 1248 | Parameters |
| 1249 | ---------- |
| 1250 | estimator : estimator instance |
| 1251 | Estimator object to test. |
| 1252 | |
| 1253 | Returns |
| 1254 | ------- |
| 1255 | out : bool |
| 1256 | True if estimator is a classifier and False otherwise. |
| 1257 | |
| 1258 | Examples |
| 1259 | -------- |
| 1260 | >>> from sklearn.base import is_classifier |
| 1261 | >>> from sklearn.cluster import KMeans |
| 1262 | >>> from sklearn.svm import SVC, SVR |
| 1263 | >>> classifier = SVC() |
| 1264 | >>> regressor = SVR() |
| 1265 | >>> kmeans = KMeans() |
| 1266 | >>> is_classifier(classifier) |
| 1267 | True |
| 1268 | >>> is_classifier(regressor) |
| 1269 | False |
| 1270 | >>> is_classifier(kmeans) |
| 1271 | False |
| 1272 | """ |
| 1273 | return get_tags(estimator).estimator_type == "classifier" |
| 1274 | |
| 1275 | |
| 1276 | def is_regressor(estimator): |
searching dependent graphs…