From 5bc7a5c23d7d9bb0a160fa200887d571f48eb061 Mon Sep 17 00:00:00 2001
From: Yannick DAYER <yannick.dayer@idiap.ch>
Date: Wed, 29 May 2024 15:10:31 +0200
Subject: [PATCH] tests: skip tests with k-means++ in dask_ml k_init

With the latests versions of dask_ml, `KMeans` and  `k_init` try to use
the `kmeans_plusplus` of sklearn without the `sample_weights` argument.
---
 tests/test_gmm.py    | 4 ++++
 tests/test_kmeans.py | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/tests/test_gmm.py b/tests/test_gmm.py
index af77842..a7e67c2 100644
--- a/tests/test_gmm.py
+++ b/tests/test_gmm.py
@@ -15,6 +15,7 @@ import tempfile
 from copy import deepcopy
 
 import numpy as np
+import pytest
 
 from dask.distributed import Client
 from h5py import File as HDF5File
@@ -484,6 +485,9 @@ def test_machine_parameters():
     np.testing.assert_equal(machine.variances, new_variances)
 
 
+@pytest.mark.skip(
+    reason="dask-ml=2024.4.4 not compatible with sklearn>=1.3 ('_kmeans_plusplus' requires the 'sample_weight' argument)"
+)
 def test_gmm_kmeans_plusplus_init():
     n_gaussians = 3
     machine = GMMMachine(
diff --git a/tests/test_kmeans.py b/tests/test_kmeans.py
index 15ccfe1..ecaf2fa 100644
--- a/tests/test_kmeans.py
+++ b/tests/test_kmeans.py
@@ -14,6 +14,7 @@ import copy
 
 import dask.array as da
 import numpy as np
+import pytest
 import scipy.spatial.distance
 
 from bob.learn.em import KMeansMachine, kmeans
@@ -116,6 +117,9 @@ def test_kmeans_fit_parallel():
         np.testing.assert_almost_equal(centroids, expected, decimal=7)
 
 
+@pytest.mark.skip(
+    reason="dask-ml=2024.4.4 not compatible with sklearn>=1.3 ('_kmeans_plusplus' requires the 'sample_weight' argument)"
+)
 def test_kmeans_fit_init_pp():
     np.random.seed(0)
     data1 = np.random.normal(loc=1, size=(2000, 3))
-- 
GitLab