code: def test_weighted_kmeans(nrows, ncols, nclusters, n_parts, client):
      cluster_std = 10000.0
      from cuml.dask.cluster import KMeans as cumlKMeans
  
      from cuml.dask.datasets import make_blobs
  
      # Using fairly high variance between points in clusters
      wt = cp.array([0.00001 for j in range(nrows)])
  
      bound = nclusters * 100000
  
      # Open the space really large
      centers = cp.random.uniform(
          -bound, bound, size=(nclusters, ncols)
      )
  
      X_cudf, y = make_blobs(
          n_samples=nrows,
          n_features=ncols,
          centers=centers,
          n_parts=n_parts,
          cluster_std=cluster_std,
          shuffle=False,
          verbose=False,
          random_state=10,
      )
  
      # Choose one sample from each label and increase its weight
      for i in range(nclusters):
          wt[cp.argmax(cp.array(y.compute()) == i).item()] = 5000.0
  
      cumlModel = cumlKMeans(
          verbose=0,
          init="k-means||",
          n_clusters=nclusters,
          random_state=10,
      )
  
      chunk_parts = int(nrows / n_parts)
      sample_weights = da.from_array(wt, chunks=(chunk_parts,))
      cumlModel.fit(X_cudf, sample_weight=sample_weights)
  
      X = X_cudf.compute()
  
      labels_ = cumlModel.predict(X_cudf).compute()
      cluster_centers_ = cumlModel.cluster_centers_
  
      for i in range(nrows):
          label = labels_[i]
          actual_center = cluster_centers_[label]
  
          diff = sum(abs(X[i] - actual_center))
  
          # The large weight should be the centroid
          if wt[i] > 1.0:
              assert diff < 1.0
  
          # Otherwise it should be pretty far away
          else:
              assert diff > 1000.0
  
file_path: cuml/python/cuml/tests/dask/test_dask_kmeans.py
imports: from cuml.dask.common.dask_arr_utils import to_dask_cudf
  from sklearn.metrics import adjusted_rand_score
  from cuml.metrics import adjusted_rand_score
  import dask.array
  from cuml.testing.utils import stress_param
  from cuml.testing.utils import quality_param
  from cuml.testing.utils import unit_param
  import pytest
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 3 for calling a global function with example usage: test_weighted_kmeans(nrows, ncols, nclusters, n_parts, client) without return types