class_docstr: K-means clustering.
  
  :param max_iteration_count: the maximum number of algorithm iterations.
  :type max_iteration_count: int
  
  :param cluster_count: the number of clusters.
  :type cluster_count: int
  
  :param algo: the algorithm used during clustering.
  :type algo: str, {'elkan', 'lloyd'}, default='lloyd'
  
  :param init: the algorithm used for selecting initial centers.
  :type init: str, {'k++', 'default'}, default='default'
  
  :param distance: the distance function.
  :type distance: str, {'euclid', 'machalanobis', 'cosine'}, default='euclid'
  
  :param thread_count: number of threads
  :type thread_count: int, > 0, default=1
  
  :param run_count: number of runs, the result is the best of the runs (based on inertia)
  :type run_count: int, > 0, default=1
  
  :param seed: the initial seed for random
  :type seed: int, default=3306
class_docstr_tok: ["K-means","clustering",".",":","param","max_iteration_count",":","the","maximum","number","of","algorithm","iterations",".",":","type","max_iteration_count",":","int",":","param","cluster_count",":","the","number","of","clusters",".",":","type","cluster_count",":","int",":","param","algo",":","the","algorithm","used","during","clustering",".",":","type","algo",":","str",",","{","'elkan","'",",","'lloyd","'","}",",","default='lloyd'",":","param","init",":","the","algorithm","used","for","selecting","initial","centers",".",":","type","init",":","str",",","{","'","k++","'",",","'default","'","}",",","default='default'",":","param","distance",":","the","distance","function",".",":","type","distance",":","str",",","{","'euclid","'",",","'machalanobis","'",",","'cosine","'","}",",","default='euclid'",":","param","thread_count",":","number","of","threads",":","type","thread_count",":","int",",",">","0",",","default=1",":","param","run_count",":","number","of","runs",",","the","result","is","the","best","of","the","runs","(","based","on","inertia",")",":","type","run_count",":","int",",",">","0",",","default=1",":","param","seed",":","the","initial","seed","for","random",":","type","seed",":","int",",","default=3306"]
docstr: Performs clustering of the given data.
  
  :param X: the input sample. Internally, it will be converted
      to ``dtype=np.float32``, and if a sparse matrix is provided -
      to a sparse ``scipy.csr_matrix``.
  :type X: array-like or sparse matrix of shape (n_samples, n_features)
  
  :param weight: sample weights. If `None`, then samples are equally weighted.
      `None` by default.
  :type weight: array-like of shape (n_samples,)
  
  :return:
      - **clusters** - array of integers with cluster indices for each object of `X`;
      - **centers** - cluster centers;
      - **vars** - cluster variances.
  :rtype:
      - tuple(clusters, centers, vars)
      - **clusters** - *numpy.ndarray(numpy.int32) of shape (n_samples,)*
      - **centers** - *numpy.ndarray(numpy.float32) of shape (cluster_count, n_features)*
      - **vars** - *numpy.ndarray(numpy.float32) of shape (cluster_count, n_features)*
docstr_tok: ["Performs","clustering","of","the","given","data",".",":","param","X",":","the","input","sample",".","Internally",",","it","will","be","converted","to","``","dtype=np.float32","``",",","and","if","a","sparse","matrix","is","provided","-","to","a","sparse","``","scipy.csr_matrix","``",".",":","type","X",":","array-like","or","sparse","matrix","of","shape","(","n_samples",",","n_features",")",":","param","weight",":","sample","weights",".","If","`","None","`",",","then","samples","are","equally","weighted",".","`","None","`","by","default",".",":","type","weight",":","array-like","of","shape","(","n_samples",",",")",":","return",":","-","*","*","clusters","*","*","-","array","of","integers","with","cluster","indices","for","each","object","of","`","X","`",";","-","*","*","centers","*","*","-","cluster","centers",";","-","*","*","vars","*","*","-","cluster","variances",".",":","rtype",":","-","tuple","(","clusters",",","centers",",","vars",")","-","*","*","clusters","*","*","-","*","numpy.ndarray","(","numpy.int32",")","of","shape","(","n_samples",",",")","*","-","*","*","centers","*","*","-","*","numpy.ndarray","(","numpy.float32",")","of","shape","(","cluster_count",",","n_features",")","*","-","*","*","vars","*","*","-","*","numpy.ndarray","(","numpy.float32",")","of","shape","(","cluster_count",",","n_features",")","*"]
code: def clusterize(self, X, weight=None):
      """Performs clustering of the given data.
  
      :param X: the input sample. Internally, it will be converted
          to ``dtype=np.float32``, and if a sparse matrix is provided -
          to a sparse ``scipy.csr_matrix``.
      :type X: array-like or sparse matrix of shape (n_samples, n_features)
  
      :param weight: sample weights. If `None`, then samples are equally weighted.
          `None` by default.
      :type weight: array-like of shape (n_samples,)
  
      :return:
          - **clusters** - array of integers with cluster indices for each object of `X`;
          - **centers** - cluster centers;
          - **vars** - cluster variances.
      :rtype:
          - tuple(clusters, centers, vars)
          - **clusters** - *numpy.ndarray(numpy.int32) of shape (n_samples,)*
          - **centers** - *numpy.ndarray(numpy.float32) of shape (cluster_count, n_features)*
          - **vars** - *numpy.ndarray(numpy.float32) of shape (cluster_count, n_features)*
  
      """
      x = convert_data(X)
  
      if weight is None:
          weight = numpy.ones(x.shape[0], numpy.float32, order="C")
      else:
          weight = numpy.array(
              weight, dtype=numpy.float32, copy=False, order="C"
          )
          if numpy.any(weight < 0):
              raise ValueError("All `weight` elements must be >= 0.")
  
      return super().clusterize(*get_data(x), int(x.shape[1]), weight)
  
file_path: neoml/NeoML/Python/neoml/Clustering.py
imports: import numpy
  from .Utils import convert_data, get_data
  from scipy.sparse import csr_matrix
  import neoml.PythonWrapper
label_desc: Use image node_id 2 for calling the KMeans obj's underlying member method code with example usage: obj.clusterize(X, weight) and returns: super