class_docstr: Hierarchical clustering. 
  First, it creates a cluster per element, the merges closest clusters on each step 
  until the final cluster is achieved.
  
  :param max_cluster_distance: the maximum distance between two clusters that still may be merged.
  :type max_cluster_distance: float
  
  :param min_cluster_count: the minimum number of clusters in the result.
  :type min_cluster_count: int
  
  :param distance: the distance function.
  :type distance: str, {'euclid', 'machalanobis', 'cosine'}, default='euclid'
  
  :param linkage: the approach used for distance calculation between clusters
  :type linkage: str, {'centroid', 'single', 'average', 'complete', 'ward'}, default='centroid'
class_docstr_tok: ["Hierarchical","clustering",".","First",",","it","creates","a","cluster","per","element",",","the","merges","closest","clusters","on","each","step","until","the","final","cluster","is","achieved",".",":","param","max_cluster_distance",":","the","maximum","distance","between","two","clusters","that","still","may","be","merged",".",":","type","max_cluster_distance",":","float",":","param","min_cluster_count",":","the","minimum","number","of","clusters","in","the","result",".",":","type","min_cluster_count",":","int",":","param","distance",":","the","distance","function",".",":","type","distance",":","str",",","{","'euclid","'",",","'machalanobis","'",",","'cosine","'","}",",","default='euclid'",":","param","linkage",":","the","approach","used","for","distance","calculation","between","clusters",":","type","linkage",":","str",",","{","'centroid","'",",","'single","'",",","'average","'",",","'complete","'",",","'ward","'","}",",","default='centroid","'"]
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, sparse matrix} of shape (n_samples, n_features)
  
  :param weight: sample weights. If `None`, then samples are equally weighted.
  :type weight: array-like of shape (n_samples,) or None, default=None
  
  :return:
      - **clusters** - 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 (init_cluster_count, n_features)*
      - **vars** - *numpy.ndarray(numpy.float32) of shape (init_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",",","sparse","matrix","}","of","shape","(","n_samples",",","n_features",")",":","param","weight",":","sample","weights",".","If","`","None","`",",","then","samples","are","equally","weighted",".",":","type","weight",":","array-like","of","shape","(","n_samples",",",")","or","None",",","default=None",":","return",":","-","*","*","clusters","*","*","-","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","(","init_cluster_count",",","n_features",")","*","-","*","*","vars","*","*","-","*","numpy.ndarray","(","numpy.float32",")","of","shape","(","init_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, sparse matrix} of shape (n_samples, n_features)
  
      :param weight: sample weights. If `None`, then samples are equally weighted.
      :type weight: array-like of shape (n_samples,) or None, default=None
  
      :return:
          - **clusters** - 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 (init_cluster_count, n_features)*
          - **vars** - *numpy.ndarray(numpy.float32) of shape (init_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 Hierarchical obj's underlying member method code with example usage: obj.clusterize(X, weight) and returns: super