class_docstr: !
  @brief Class represents clustering algorithm K-Medians.
  @details The algorithm is less sensitive to outliers than K-Means. Medians are calculated instead of centroids.
  
  Example:
  @code
      from pyclustering.cluster.kmedians import kmedians
      from pyclustering.cluster import cluster_visualizer
      from pyclustering.utils import read_sample
      from pyclustering.samples.definitions import FCPS_SAMPLES
  
      # Load list of points for cluster analysis.
      sample = read_sample(FCPS_SAMPLES.SAMPLE_TWO_DIAMONDS)
  
      # Create instance of K-Medians algorithm.
      initial_medians = [[0.0, 0.1], [2.5, 0.7]]
      kmedians_instance = kmedians(sample, initial_medians)
  
      # Run cluster analysis and obtain results.
      kmedians_instance.process()
      clusters = kmedians_instance.get_clusters()
      medians = kmedians_instance.get_medians()
  
      # Visualize clustering results.
      visualizer = cluster_visualizer()
      visualizer.append_clusters(clusters, sample)
      visualizer.append_cluster(initial_medians, marker='*', markersize=10)
      visualizer.append_cluster(medians, marker='*', markersize=10)
      visualizer.show()
  @endcode
class_docstr_tok: ["!","@","brief","Class","represents","clustering","algorithm","K-Medians",".","@","details","The","algorithm","is","less","sensitive","to","outliers","than","K-Means",".","Medians","are","calculated","instead","of","centroids",".","Example",":","@","code","from","pyclustering.cluster.kmedians","import","kmedians","from","pyclustering.cluster","import","cluster_visualizer","from","pyclustering.utils","import","read_sample","from","pyclustering.samples.definitions","import","FCPS_SAMPLES","#","Load","list","of","points","for","cluster","analysis",".","sample","=","read_sample","(","FCPS_SAMPLES.SAMPLE_TWO_DIAMONDS",")","#","Create","instance","of","K-Medians","algorithm",".","initial_medians","=","[","[","0.0",",","0.1","]",",","[","2.5",",","0.7","]","]","kmedians_instance","=","kmedians","(","sample",",","initial_medians",")","#","Run","cluster","analysis","and","obtain","results",".","kmedians_instance.process","(",")","clusters","=","kmedians_instance.get_clusters","(",")","medians","=","kmedians_instance.get_medians","(",")","#","Visualize","clustering","results",".","visualizer","=","cluster_visualizer","(",")","visualizer.append_clusters","(","clusters",",","sample",")","visualizer.append_cluster","(","initial_medians",",","marker=","'","*","'",",","markersize=10",")","visualizer.append_cluster","(","medians",",","marker=","'","*","'",",","markersize=10",")","visualizer.show","(",")","@","endcode"]
docstr: !
  @brief Verify input parameters for the algorithm and throw exception in case of incorrectness.
docstr_tok: ["!","@","brief","Verify","input","parameters","for","the","algorithm","and","throw","exception","in","case","of","incorrectness","."]
code: def __verify_arguments(self):
      """!
      @brief Verify input parameters for the algorithm and throw exception in case of incorrectness.
  
      """
      if len(self.__pointer_data) == 0:
          raise ValueError(
              "Input data is empty (size: '%d')."
              % len(self.__pointer_data)
          )
  
      if not hasattr(self.__pointer_data[0], "__getitem__"):
          raise TypeError(
              "Input data element does not have attribute '__getitem__'."
          )
  
      if len(self.__medians) == 0:
          raise ValueError(
              "Initial medians are empty (size: '%d')."
              % len(self.__medians)
          )
  
      if not hasattr(self.__medians[0], "__getitem__"):
          raise TypeError(
              "Initial medians element does not have attribute '__getitem__'."
          )
  
      if self.__tolerance < 0:
          raise ValueError(
              "Tolerance (current value: '%d') should be greater or equal to 0."
              % self.__tolerance
          )
  
      if self.__itermax < 0:
          raise ValueError(
              "Maximum iterations (current value: '%d') should be greater or equal to 0."
              % self.__itermax
          )
  
file_path: pyclustering/pyclustering/cluster/kmedians.py
imports: import math
  import numpy
  from pyclustering.cluster.encoder import type_encoding
  from pyclustering.utils.metric import distance_metric, type_metric
  import pyclustering.core.kmedians_wrapper
  from pyclustering.core.wrapper import ccore_library
  from pyclustering.core.metric_wrapper import metric_wrapper
label_desc: Use image node_id 12 for calling the kmedians obj's underlying member method code with example usage: obj.__verify_arguments() without return types