def predict_variant(X): np.random.seed(42) return np.array( [1 if r > 0.0 else -1 for r in np.random.normal(0, 1, len(X))]) def class_based(dataf, sex="male", pclass=1): predicate = (dataf["sex"] == sex) & (dataf["pclass"] == pclass) return np.array(predicate).astype(int) * 2 - 1 @pytest.mark.parametrize( "test_fn", select_tests( include=flatten([general_checks, outlier_checks, nonmeta_checks]), exclude=[ "check_outliers_train", "check_estimators_nan_inf", "check_estimators_empty_data_messages", "check_complex_data", "check_dtype_object", "check_classifier_data_not_an_array", "check_fit1d", "check_methods_subset_invariance", "check_fit2d_predict1d", "check_estimator_sparse_data", ], ), ) def test_estimator_checks(test_fn):
def predict(X): np.random.seed(42) return np.array( [1 if r > 0.5 else 0 for r in np.random.normal(0, 1, len(X))]) def predict_variant(X): np.random.seed(42) return np.array( [1 if r > 0.0 else 0 for r in np.random.normal(0, 1, len(X))]) @pytest.mark.parametrize( "test_fn", select_tests( include=flatten([general_checks, regressor_checks, nonmeta_checks]), exclude=[ "check_methods_subset_invariance", "check_fit2d_1sample", "check_fit2d_1feature", "check_regressors_train", "check_fit2d_predict1d", "check_fit1d", "check_regressor_data_not_an_array", "check_supervised_y_2d", "check_supervised_y_no_nan", "check_dtype_object", "check_complex_data", "check_estimators_empty_data_messages", "check_estimators_nan_inf", "check_estimator_sparse_data",
from tests.conftest import ( select_tests, general_checks, transformer_checks, nonmeta_checks, ) def double(x, factor=2): return x * factor @pytest.mark.parametrize( "test_fn", select_tests( include=flatten([general_checks, transformer_checks, nonmeta_checks]), exclude=[ "check_estimators_nan_inf", "check_estimators_empty_data_messages", "check_transformer_data_not_an_array", "check_dtype_object", "check_complex_data", "check_fit1d", ], ), ) def test_estimator_checks(test_fn): clf = PipeTransformer(func=double) test_fn(PipeTransformer.__name__, clf)
from hulearn.preprocessing import PipeTransformer from hulearn.outlier import InteractiveOutlierDetector from hulearn.common import flatten from tests.conftest import ( select_tests, general_checks, classifier_checks, nonmeta_checks, ) @pytest.mark.parametrize( "test_fn", select_tests( include=flatten([general_checks, classifier_checks, nonmeta_checks]), exclude=[ "check_estimators_pickle", "check_estimator_sparse_data", "check_estimators_nan_inf", "check_pipeline_consistency", "check_complex_data", "check_fit2d_predict1d", "check_methods_subset_invariance", "check_fit1d", "check_dict_unchanged", "check_classifier_data_not_an_array", "check_classifiers_one_label", "check_classifiers_classes", "check_classifiers_train", "check_supervised_y_2d",