estimator_checks_generator#

sklearn.utils.estimator_checks.estimator_checks_generator(estimator, *, legacy: bool = True, expected_failed_checks: dict[str, str] | None = None, mark: Literal['xfail', 'skip', None] = None)[source]#

Iteratively yield all check callables for an estimator.

Added in version 1.6.

Parameters:
estimatorestimator object

Estimator instance for which to generate checks.

legacybool, default=True

Whether to include legacy checks. Over time we remove checks from this category and move them into their specific category.

expected_failed_checksdict[str, str], default=None

Dictionary of the form {check_name: reason} for checks that are expected to fail.

mark{“xfail”, “skip”} or None, default=None

Whether to mark the checks that are expected to fail as xfail(pytest.mark.xfail) or skip. Marking a test as “skip” is done via wrapping the check in a function that raises a SkipTest exception.

Returns:
estimator_checks_generatorgenerator

Generator that yields (estimator, check) tuples.