Check if estimator adheres to scikit-learn conventions.
This estimator will run an extensive test-suite for input validation, shapes, etc, making sure that the estimator complies with
scikit-learnconventions as detailed in Rolling your own estimator. Additional tests for classifiers, regressors, clustering or transformers will be run if the Estimator class inherits from the corresponding mixin from sklearn.base.
This test can be applied to classes or instances. Classes currently have some additional tests that related to construction, while passing instances allows the testing of multiple options. However, support for classes is deprecated since version 0.23 and will be removed in version 0.24 (class checks will still be run on the instances).
generate_only=Truereturns a generator that yields (estimator, check) tuples where the check can be called independently from each other, i.e.
check(estimator). This allows all checks to be run independently and report the checks that are failing.
scikit-learn provides a pytest specific decorator,
parametrize_with_checks, making it easier to test multiple estimators.
- estimatorestimator object
Estimator to check. Estimator is a class object or instance.
Deprecated since version 0.23: Passing a class is deprecated from version 0.23, and won’t be supported in 0.24. Pass an instance instead.
- generate_onlybool, optional (default=False)
False, checks are evaluated when
check_estimatoris called. When
check_estimatorreturns a generator that yields (estimator, check) tuples. The check is run by calling
New in version 0.22.
Generator that yields (estimator, check) tuples. Returned when