docstr: Compute k-means clustering.
  
  Parameters
  ----------
  X : {array-like, sparse matrix} of shape (n_samples, n_features)
      Training instances to cluster. It must be noted that the data
      will be converted to C ordering, which will cause a memory
      copy if the given data is not C-contiguous.
      If a sparse matrix is passed, a copy will be made if it's not in
      CSR format.
  
  y : Ignored
      Not used, present here for API consistency by convention.
  
  sample_weight : array-like of shape (n_samples,), default=None
      The weights for each observation in X. If None, all observations
      are assigned equal weight.
  
      .. versionadded:: 0.20
  
  Returns
  -------
  self : object
      Fitted estimator.
docstr_tok: ["Compute","k-means","clustering",".","Parameters","--","--","--","--","--","X",":","{","array-like",",","sparse","matrix","}","of","shape","(","n_samples",",","n_features",")","Training","instances","to","cluster",".","It","must","be","noted","that","the","data","will","be","converted","to","C","ordering",",","which","will","cause","a","memory","copy","if","the","given","data","is","not","C-contiguous",".","If","a","sparse","matrix","is","passed",",","a","copy","will","be","made","if","it","'s","not","in","CSR","format",".","y",":","Ignored","Not","used",",","present","here","for","API","consistency","by","convention",".","sample_weight",":","array-like","of","shape","(","n_samples",",",")",",","default=None","The","weights","for","each","observation","in","X",".","If","None",",","all","observations","are","assigned","equal","weight",".","..","versionadded",":",":","0.20","Returns","--","--","--","-","self",":","object","Fitted","estimator","."]
code: def fit(self, X, y=None, sample_weight=None):
      """
      Compute k-means clustering.
  
      Parameters
      ----------
      X : {array-like, sparse matrix} of shape (n_samples, n_features)
          Training instances to cluster. It must be noted that the data
          will be converted to C ordering, which will cause a memory
          copy if the given data is not C-contiguous.
          If a sparse matrix is passed, a copy will be made if it's not in
          CSR format.
  
      y : Ignored
          Not used, present here for API consistency by convention.
  
      sample_weight : array-like of shape (n_samples,), default=None
          The weights for each observation in X. If None, all observations
          are assigned equal weight.
  
          .. versionadded:: 0.20
  
      Returns
      -------
      self : object
          Fitted estimator.
      """
      return _fit(self, X, y=y, sample_weight=sample_weight)
  
imports: import numbers
  import warnings
  import numpy
  from scipy import sparse
  from sklearn.cluster import KMeans
  from sklearn.cluster._kmeans import _labels_inertia
  from sklearn.exceptions import ConvergenceWarning
  from sklearn.utils import check_array, check_random_state
  from sklearn.utils._openmp_helpers import _openmp_effective_n_threads
  from sklearn.utils.extmath import row_norms
  from sklearn.utils.sparsefuncs import mean_variance_axis
  from sklearn.utils.validation import _deprecate_positional_args, _num_samples, check_is_fitted
  import daal4py
  from .._device_offload import support_usm_ndarray
  from .._utils import PatchingConditionsChain, control_n_jobs, getFPType, run_with_n_jobs, sklearn_check_version
label_desc: Use image node_id 1 for calling the KMeans obj's underlying member method code with example usage: obj.fit(X, y, sample_weight) and returns: _fit