class_docstr: !
  @brief Distance metric performs distance calculation between two points in line with encapsulated function, for
          example, euclidean distance or chebyshev distance, or even user-defined.
  
  @details
  
  Example of Euclidean distance metric:
  @code
      metric = distance_metric(type_metric.EUCLIDEAN)
      distance = metric([1.0, 2.5], [-1.2, 3.4])
  @endcode
  
  Example of Chebyshev distance metric:
  @code
      metric = distance_metric(type_metric.CHEBYSHEV)
      distance = metric([0.0, 0.0], [2.5, 6.0])
  @endcode
  
  In following example additional argument should be specified (generally, 'degree' is a optional argument that is
   equal to '2' by default) that is specific for Minkowski distance:
  @code
      metric = distance_metric(type_metric.MINKOWSKI, degree=4)
      distance = metric([4.0, 9.2, 1.0], [3.4, 2.5, 6.2])
  @endcode
  
  User may define its own function for distance calculation. In this case input is two points, for example, you
  want to implement your own version of Manhattan distance:
  @code
      from pyclustering.utils.metric import distance_metric, type_metric
  
      def my_manhattan(point1, point2):
          dimension = len(point1)
          result = 0.0
          for i in range(dimension):
              result += abs(point1[i] - point2[i]) * 0.1
          return result
  
      metric = distance_metric(type_metric.USER_DEFINED, func=my_manhattan)
      distance = metric([2.0, 3.0], [1.0, 3.0])
  @endcode
class_docstr_tok: ["!","@","brief","Distance","metric","performs","distance","calculation","between","two","points","in","line","with","encapsulated","function",",","for","example",",","euclidean","distance","or","chebyshev","distance",",","or","even","user-defined",".","@","details","Example","of","Euclidean","distance","metric",":","@","code","metric","=","distance_metric","(","type_metric.EUCLIDEAN",")","distance","=","metric","(","[","1.0",",","2.5","]",",","[","-1.2",",","3.4","]",")","@","endcode","Example","of","Chebyshev","distance","metric",":","@","code","metric","=","distance_metric","(","type_metric.CHEBYSHEV",")","distance","=","metric","(","[","0.0",",","0.0","]",",","[","2.5",",","6.0","]",")","@","endcode","In","following","example","additional","argument","should","be","specified","(","generally",",","'degree","'","is","a","optional","argument","that","is","equal","to","'","2","'","by","default",")","that","is","specific","for","Minkowski","distance",":","@","code","metric","=","distance_metric","(","type_metric.MINKOWSKI",",","degree=4",")","distance","=","metric","(","[","4.0",",","9.2",",","1.0","]",",","[","3.4",",","2.5",",","6.2","]",")","@","endcode","User","may","define","its","own","function","for","distance","calculation",".","In","this","case","input","is","two","points",",","for","example",",","you","want","to","implement","your","own","version","of","Manhattan","distance",":","@","code","from","pyclustering.utils.metric","import","distance_metric",",","type_metric","def","my_manhattan","(","point1",",","point2",")",":","dimension","=","len","(","point1",")","result","=","0.0","for","i","in","range","(","dimension",")",":","result","+=","abs","(","point1","[","i","]","-","point2","[","i","]",")","*","0.1","return","result","metric","=","distance_metric","(","type_metric.USER_DEFINED",",","func=my_manhattan",")","distance","=","metric","(","[","2.0",",","3.0","]",",","[","1.0",",","3.0","]",")","@","endcode"]
docstr: !
  @brief Creates distance metric calculator that does not use numpy.
  
  @return (callable) Callable object of distance metric calculator.
docstr_tok: ["!","@","brief","Creates","distance","metric","calculator","that","does","not","use","numpy",".","@","return","(","callable",")","Callable","object","of","distance","metric","calculator","."]
code: def __create_distance_calculator_basic(self):
      """!
      @brief Creates distance metric calculator that does not use numpy.
  
      @return (callable) Callable object of distance metric calculator.
  
      """
      if self.__type == type_metric.EUCLIDEAN:
          return euclidean_distance
  
      elif self.__type == type_metric.EUCLIDEAN_SQUARE:
          return euclidean_distance_square
  
      elif self.__type == type_metric.MANHATTAN:
          return manhattan_distance
  
      elif self.__type == type_metric.CHEBYSHEV:
          return chebyshev_distance
  
      elif self.__type == type_metric.MINKOWSKI:
          return lambda point1, point2: minkowski_distance(
              point1, point2, self.__args.get("degree", 2)
          )
  
      elif self.__type == type_metric.CANBERRA:
          return canberra_distance
  
      elif self.__type == type_metric.CHI_SQUARE:
          return chi_square_distance
  
      elif self.__type == type_metric.GOWER:
          max_range = self.__get_gower_max_range()
          return lambda point1, point2: gower_distance(
              point1, point2, max_range
          )
  
      elif self.__type == type_metric.USER_DEFINED:
          return self.__func
  
      else:
          raise ValueError("Unknown type of metric: '%d'", self.__type)
  
imports: import numpy
  from enum import IntEnum
label_desc: Use image node_id 9 for calling the distance_metric obj's underlying member method code with example usage: obj.__create_distance_calculator_basic() and returns: euclidean_distance, euclidean_distance_square, manhattan_distance, chebyshev_distance, function, canberra_distance, chi_square_distance, function, self