sklearn.utils.estimator_checks.check_estimator

sklearn.utils.estimator_checks.check_estimator(Estimator, generate_only=False)[source]

Check if estimator adheres to scikit-learn conventions.

This estimator will run an extensive test-suite for input validation, shapes, etc. 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.

Read more in Rolling your own estimator.

Parameters
estimatorestimator object or class

Estimator to check. Estimator is a class object or instance.

generate_onlybool, optional (default=False)

When False, checks are evaluated when check_estimator is called. When True, check_estimator returns a generator that yields (estimator, check) tuples. The check is run by calling check(estimator).

New in version 0.22.

Returns
checks_generatorgenerator

Generator that yields (estimator, check) tuples. Returned when generate_only=True.