From 9fc80a2249a596bd397f0912120109bdfec9032d Mon Sep 17 00:00:00 2001 From: Victoriya Fedotova Date: Wed, 25 Sep 2024 09:09:39 -0700 Subject: [PATCH] Replace TODO notes with pytest.skip --- onedal/svm/tests/test_csr_svm.py | 6 +++--- onedal/svm/tests/test_nusvr.py | 6 +++--- onedal/svm/tests/test_svr.py | 6 +++--- sklearnex/cluster/tests/test_kmeans.py | 7 ++++--- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/onedal/svm/tests/test_csr_svm.py b/onedal/svm/tests/test_csr_svm.py index d8eaa3355b..e4a05a030e 100644 --- a/onedal/svm/tests/test_csr_svm.py +++ b/onedal/svm/tests/test_csr_svm.py @@ -160,10 +160,10 @@ def _test_diabetes(queue, kernel): @pass_if_not_implemented_for_gpu(reason="csr svm is not implemented") @pytest.mark.parametrize("queue", get_queues()) -# TODO: investigate failures in kernel="sigmoid" after migration to oneMKL -# @pytest.mark.parametrize("kernel", ["linear", "rbf", "poly", "sigmoid"]) -@pytest.mark.parametrize("kernel", ["linear", "rbf", "poly"]) +@pytest.mark.parametrize("kernel", ["linear", "rbf", "poly", "sigmoid"]) def test_diabetes(queue, kernel): + if kernel == "sigmoid": + pytest.skip("Sparse sigmoid kernel function is buggy.") _test_diabetes(queue, kernel) diff --git a/onedal/svm/tests/test_nusvr.py b/onedal/svm/tests/test_nusvr.py index d84ae07a5e..1bec991961 100644 --- a/onedal/svm/tests/test_nusvr.py +++ b/onedal/svm/tests/test_nusvr.py @@ -107,10 +107,10 @@ def _test_diabetes_compare_with_sklearn(queue, kernel): @pass_if_not_implemented_for_gpu(reason="nusvr is not implemented") @pytest.mark.parametrize("queue", get_queues()) -# TODO: investigate failures in kernel="sigmoid" after migration to oneMKL -# @pytest.mark.parametrize("kernel", ["linear", "rbf", "poly", "sigmoid"]) -@pytest.mark.parametrize("kernel", ["linear", "rbf", "poly"]) +@pytest.mark.parametrize("kernel", ["linear", "rbf", "poly", "sigmoid"]) def test_diabetes_compare_with_sklearn(queue, kernel): + if kernel == "sigmoid": + pytest.skip("Sparse sigmoid kernel function is buggy.") _test_diabetes_compare_with_sklearn(queue, kernel) diff --git a/onedal/svm/tests/test_svr.py b/onedal/svm/tests/test_svr.py index ad33d11dbb..a9000ff5f7 100644 --- a/onedal/svm/tests/test_svr.py +++ b/onedal/svm/tests/test_svr.py @@ -122,10 +122,10 @@ def _test_diabetes_compare_with_sklearn(queue, kernel): @pass_if_not_implemented_for_gpu(reason="svr is not implemented") @pytest.mark.parametrize("queue", get_queues()) -# TODO: investigate failures in kernel="sigmoid" after migration to oneMKL -# @pytest.mark.parametrize("kernel", ["linear", "rbf", "poly", "sigmoid"]) -@pytest.mark.parametrize("kernel", ["linear", "rbf", "poly"]) +@pytest.mark.parametrize("kernel", ["linear", "rbf", "poly", "sigmoid"]) def test_diabetes_compare_with_sklearn(queue, kernel): + if kernel == "sigmoid": + pytest.skip("Sparse sigmoid kernel function is buggy.") _test_diabetes_compare_with_sklearn(queue, kernel) diff --git a/sklearnex/cluster/tests/test_kmeans.py b/sklearnex/cluster/tests/test_kmeans.py index c49abaa914..def4ab5bc4 100755 --- a/sklearnex/cluster/tests/test_kmeans.py +++ b/sklearnex/cluster/tests/test_kmeans.py @@ -120,9 +120,7 @@ def test_results_on_dense_gold_data(dataframe, queue, algorithm): reason="Sparse data requires oneDAL>=2024.7.0", ) @pytest.mark.parametrize("queue", get_queues()) -# TODO: investigate failures in init="random" after migration to oneMKL -# @pytest.mark.parametrize("init", ["k-means++", "random", "arraylike"]) -@pytest.mark.parametrize("init", ["k-means++", "arraylike"]) +@pytest.mark.parametrize("init", ["k-means++", "random", "arraylike"]) @pytest.mark.parametrize("algorithm", ["lloyd", "elkan"]) @pytest.mark.parametrize( "dims", [(1000, 10, 0.95, 3), (50000, 100, 0.75, 10), (10000, 10, 0.8, 5)] @@ -130,6 +128,9 @@ def test_results_on_dense_gold_data(dataframe, queue, algorithm): def test_dense_vs_sparse(queue, init, algorithm, dims): from sklearnex.cluster import KMeans + if init == "random": + pytest.skip("random initialization in sparse K-means is buggy.") + # For higher level of sparsity (smaller density) the test may fail n_samples, n_features, density, n_clusters = dims X_dense = generate_dense_dataset(n_samples, n_features, density, n_clusters)