def yield_all_checks(name, estimator): tags = estimator._get_tags() if "2darray" not in tags["X_types"]: warnings.warn("Can't test estimator {} which requires input " " of type {}".format(name, tags["X_types"]), SkipTestWarning) return if tags["_skip_test"]: warnings.warn("Explicit SKIP via _skip_test tag for estimator " "{}.".format(name), SkipTestWarning) return yield from _yield_checks(name, estimator) if is_classifier(estimator): yield from _yield_classifier_checks(name, estimator) if is_regressor(estimator): yield from _yield_regressor_checks(name, estimator) if hasattr(estimator, 'transform'): if not tags["allow_variable_length"]: # Transformer tests ensure that shapes are the same at fit and # transform time, hence we need to skip them for estimators that # allow variable-length inputs yield from _yield_transformer_checks(name, estimator) if isinstance(estimator, ClusterMixin): yield from _yield_clustering_checks(name, estimator) if is_outlier_detector(estimator): yield from _yield_outliers_checks(name, estimator) # We are not strict on presence/absence of the 3rd dimension # yield check_fit2d_predict1d if not tags["non_deterministic"]: yield check_methods_subset_invariance yield check_fit2d_1sample yield check_fit2d_1feature yield check_fit1d yield check_get_params_invariance yield check_set_params yield check_dict_unchanged yield check_dont_overwrite_parameters yield check_fit_idempotent if (is_classifier(estimator) or is_regressor(estimator) or isinstance(estimator, ClusterMixin)): if tags["allow_variable_length"]: yield check_different_length_fit_predict_transform
def yield_all_checks(name, estimator): tags = _safe_tags(estimator) if "2darray" not in tags["X_types"]: warnings.warn( "Can't test estimator {} which requires input " " of type {}".format(name, tags["X_types"]), SkipTestWarning) return if tags["_skip_test"]: warnings.warn( "Explicit SKIP via _skip_test tag for estimator " "{}.".format(name), SkipTestWarning) return for check in _yield_checks(name, estimator): yield check if is_classifier(estimator): for check in _yield_classifier_checks(name, estimator): yield check if is_regressor(estimator): for check in _yield_regressor_checks(name, estimator): yield check if hasattr(estimator, 'transform'): for check in _yield_transformer_checks(name, estimator): yield check if isinstance(estimator, ClusterMixin): for check in _yield_clustering_checks(name, estimator): yield check if is_outlier_detector(estimator): for check in _yield_outliers_checks(name, estimator): yield check yield check_fit2d_predict1d if not tags["non_deterministic"]: yield check_methods_subset_invariance yield check_fit2d_1sample yield check_fit2d_1feature yield check_fit1d yield check_get_params_invariance yield check_set_params yield check_dict_unchanged yield check_dont_overwrite_parameters yield check_fit_idempotent