class_docstr: !
  @brief Class represents clustering algorithm CLARANS (a method for clustering objects for spatial data mining).
class_docstr_tok: ["!","@","brief","Class","represents","clustering","algorithm","CLARANS","(","a","method","for","clustering","objects","for","spatial","data","mining",")","."]
docstr: !
  @brief Performs cluster analysis in line with rules of CLARANS algorithm.
  
  @return (clarans) Returns itself (CLARANS instance).
  
  @see get_clusters()
  @see get_medoids()
docstr_tok: ["!","@","brief","Performs","cluster","analysis","in","line","with","rules","of","CLARANS","algorithm",".","@","return","(","clarans",")","Returns","itself","(","CLARANS","instance",")",".","@","see","get_clusters","(",")","@","see","get_medoids","(",")"]
code: def process(self):
      """!
      @brief Performs cluster analysis in line with rules of CLARANS algorithm.
  
      @return (clarans) Returns itself (CLARANS instance).
  
      @see get_clusters()
      @see get_medoids()
  
      """
  
      random.seed()
  
      for _ in range(0, self.__numlocal):
          # set (current) random medoids
          self.__current = random.sample(
              range(0, len(self.__pointer_data)), self.__number_clusters
          )
  
          # update clusters in line with random allocated medoids
          self.__update_clusters(self.__current)
  
          # optimize configuration
          self.__optimize_configuration()
  
          # obtain cost of current cluster configuration and compare it with the best obtained
          estimation = self.__calculate_estimation()
          if estimation < self.__optimal_estimation:
              self.__optimal_medoids = self.__current[:]
              self.__optimal_estimation = estimation
  
      self.__update_clusters(self.__optimal_medoids)
      return self
  
file_path: pyclustering/pyclustering/cluster/clarans.py
imports: import random
  from pyclustering.cluster.encoder import type_encoding
  from pyclustering.utils import euclidean_distance_square
label_desc: Use image node_id 3 for calling the clarans obj's underlying member method code with example usage: obj.process() and returns: self