Check that an estimator has the method attribute. If method == 'transform' and estimator does not have 'transform', use 'predict' instead.
(estimator, method)
| 466 | |
| 467 | |
| 468 | def _check_method(estimator, method): |
| 469 | """Check that an estimator has the method attribute. |
| 470 | |
| 471 | If method == 'transform' and estimator does not have 'transform', use |
| 472 | 'predict' instead. |
| 473 | """ |
| 474 | if method == "transform" and not hasattr(estimator, "transform"): |
| 475 | method = "predict" |
| 476 | if not hasattr(estimator, method): |
| 477 | ValueError(f"base_estimator does not have `{method}` method.") |
| 478 | return method |
| 479 | |
| 480 | |
| 481 | @fill_doc |
no outgoing calls
no test coverage detected