diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 78f19c0b..a72f0a90 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -149,4 +149,4 @@ jobs: - name: Run sklearn integration tests for ${{ matrix.sklearn-version }} run: | - python -m pytest -x -p no:warnings tests/integrations/sklearn/ + python -m pytest -x -p no:warnings src/hyperactive/integrations/sklearn/ diff --git a/src/hyperactive/integrations/sklearn/tests/__init__.py b/src/hyperactive/integrations/sklearn/tests/__init__.py new file mode 100644 index 00000000..bc05fd47 --- /dev/null +++ b/src/hyperactive/integrations/sklearn/tests/__init__.py @@ -0,0 +1 @@ +"""Tests for sklearn integrations.""" diff --git a/src/hyperactive/integrations/sklearn/tests/test_parametrize_with_checks.py b/src/hyperactive/integrations/sklearn/tests/test_parametrize_with_checks.py new file mode 100644 index 00000000..97fdb21e --- /dev/null +++ b/src/hyperactive/integrations/sklearn/tests/test_parametrize_with_checks.py @@ -0,0 +1,22 @@ +"""Test module for sklearn parametrize_with_checks integration.""" + +from sklearn import svm +from sklearn.model_selection import KFold +from sklearn.utils.estimator_checks import parametrize_with_checks + +from hyperactive.integrations import OptCV +from hyperactive.opt import GridSearchSk as GridSearch + +svc = svm.SVC() +parameters = {"kernel": ["linear", "rbf"], "C": [1, 10]} + +cv = KFold(n_splits=2, shuffle=True, random_state=42) +optcv = OptCV(estimator=svc, optimizer=GridSearch(param_grid=parameters), cv=cv) + +ESTIMATORS = [optcv] + + +@parametrize_with_checks(ESTIMATORS) +def test_estimators(estimator, check): + """Test estimators with sklearn estimator checks.""" + check(estimator)