class_docstr: Multi-Node Multi-GPU implementation of KMeans.
  
  This version minimizes data transfer by sharing only
  the centroids between workers in each iteration.
  
  Predictions are done embarrassingly parallel, using cuML's
  single-GPU version.
  
  For more information on this implementation, refer to the
  documentation for single-GPU K-Means.
  
  Parameters
  ----------
  
  handle : cuml.Handle
      Specifies the cuml.handle that holds internal CUDA state for
      computations in this model. Most importantly, this specifies the CUDA
      stream that will be used for the model's computations, so users can
      run different models concurrently in different streams by creating
      handles in several streams.
      If it is None, a new one is created.
  n_clusters : int (default = 8)
      The number of centroids or clusters you want.
  max_iter : int (default = 300)
      The more iterations of EM, the more accurate, but slower.
  tol : float (default = 1e-4)
      Stopping criterion when centroid means do not change much.
  verbose : int or boolean, default=False
      Sets logging level. It must be one of `cuml.common.logger.level_*`.
      See :ref:`verbosity-levels` for more info.
  random_state : int (default = 1)
      If you want results to be the same when you restart Python,
      select a state.
  init : {'scalable-kmeans++', 'k-means||' , 'random' or an ndarray}            (default = 'scalable-k-means++')
      'scalable-k-means++' or 'k-means||': Uses fast and stable scalable
      kmeans++ initialization.
      'random': Choose 'n_cluster' observations (rows) at random
      from data for the initial centroids. If an ndarray is passed,
      it should be of shape (n_clusters, n_features) and gives the
      initial centers.
  oversampling_factor : int (default = 2)
      The amount of points to sample in scalable k-means++ initialization for
      potential centroids. Increasing this value can lead to better initial
      centroids at the cost of memory. The total number of centroids sampled
      in scalable k-means++ is oversampling_factor * n_clusters * 8.
  max_samples_per_batch : int (default = 32768)
      The number of data samples to use for batches of the pairwise distance
      computation. This computation is done throughout both fit predict.
      The default should suit most cases. The total number of elements in the
      batched pairwise distance computation is max_samples_per_batch
      * n_clusters. It might become necessary to lower this number when
      n_clusters becomes prohibitively large.
  
  Attributes
  ----------
  cluster_centers_ : cuDF DataFrame or CuPy ndarray
      The coordinates of the final clusters. This represents of "mean" of
      each data cluster.
class_docstr_tok: ["Multi-Node","Multi-GPU","implementation","of","KMeans",".","This","version","minimizes","data","transfer","by","sharing","only","the","centroids","between","workers","in","each","iteration",".","Predictions","are","done","embarrassingly","parallel",",","using","cuML's","single-GPU","version",".","For","more","information","on","this","implementation",",","refer","to","the","documentation","for","single-GPU","K-Means",".","Parameters","--","--","--","--","--","handle",":","cuml.Handle","Specifies","the","cuml.handle","that","holds","internal","CUDA","state","for","computations","in","this","model",".","Most","importantly",",","this","specifies","the","CUDA","stream","that","will","be","used","for","the","model","'s","computations",",","so","users","can","run","different","models","concurrently","in","different","streams","by","creating","handles","in","several","streams",".","If","it","is","None",",","a","new","one","is","created",".","n_clusters",":","int","(","default","=","8",")","The","number","of","centroids","or","clusters","you","want",".","max_iter",":","int","(","default","=","300",")","The","more","iterations","of","EM",",","the","more","accurate",",","but","slower",".","tol",":","float","(","default","=","1e-4",")","Stopping","criterion","when","centroid","means","do","not","change","much",".","verbose",":","int","or","boolean",",","default=False","Sets","logging","level",".","It","must","be","one","of","`","cuml.common.logger.level_","*","`",".","See",":","ref",":","`","verbosity-levels","`","for","more","info",".","random_state",":","int","(","default","=","1",")","If","you","want","results","to","be","the","same","when","you","restart","Python",",","select","a","state",".","init",":","{","'scalable-kmeans++","'",",","'","k-means||","'",",","'random","'","or","an","ndarray","}","(","default","=","'scalable-k-means++","'",")","'scalable-k-means++","'","or","'","k-means||","'",":","Uses","fast","and","stable","scalable","kmeans++","initialization",".","'random","'",":","Choose","'n_cluster","'","observations","(","rows",")","at","random","from","data","for","the","initial","centroids",".","If","an","ndarray","is","passed",",","it","should","be","of","shape","(","n_clusters",",","n_features",")","and","gives","the","initial","centers",".","oversampling_factor",":","int","(","default","=","2",")","The","amount","of","points","to","sample","in","scalable","k-means++","initialization","for","potential","centroids",".","Increasing","this","value","can","lead","to","better","initial","centroids","at","the","cost","of","memory",".","The","total","number","of","centroids","sampled","in","scalable","k-means++","is","oversampling_factor","*","n_clusters","*","8.","max_samples_per_batch",":","int","(","default","=","32768",")","The","number","of","data","samples","to","use","for","batches","of","the","pairwise","distance","computation",".","This","computation","is","done","throughout","both","fit","predict",".","The","default","should","suit","most","cases",".","The","total","number","of","elements","in","the","batched","pairwise","distance","computation","is","max_samples_per_batch","*","n_clusters",".","It","might","become","necessary","to","lower","this","number","when","n_clusters","becomes","prohibitively","large",".","Attributes","--","--","--","--","--","cluster_centers_",":","cuDF","DataFrame","or","CuPy","ndarray","The","coordinates","of","the","final","clusters",".","This","represents","of","``","mean","''","of","each","data","cluster","."]
code: def _func_fit(sessionId, objs, datatype, has_weights, **kwargs):
      from cuml.cluster.kmeans_mg import KMeansMG as cumlKMeans
  
      handle = get_raft_comm_state(sessionId, get_worker())["handle"]
  
      if not has_weights:
          inp_data = concatenate(objs)
          inp_weights = None
      else:
          inp_data = concatenate([X for X, weights in objs])
          inp_weights = concatenate([weights for X, weights in objs])
  
      return cumlKMeans(
          handle=handle, output_type=datatype, **kwargs
      ).fit(inp_data, sample_weight=inp_weights)
  
imports: from cuml.internals.memory_utils import with_cupy_rmm
  from cuml.dask.common.utils import wait_and_raise_from_futures
  from raft_dask.common.comms import get_raft_comm_state
  from raft_dask.common.comms import Comms
  from cuml.dask.common.input_utils import DistributedDataHandler
  from cuml.dask.common.input_utils import concatenate
  from cuml.dask.common.base import mnmg_import
  from dask.distributed import get_worker
  from cuml.dask.common.base import DelayedTransformMixin
  from cuml.dask.common.base import DelayedPredictionMixin
  from cuml.dask.common.base import BaseEstimator
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 2 for calling the KMeans obj's underlying member method code with example usage: obj._func_fit(sessionId, objs, datatype, has_weights) and returns: cumlKMeans