pyclustering/cluster/kmeans.py
def __calculate_dataset_difference(self, amount_clusters):
        """!
        @brief Calculate distance from each point to each cluster center.

        """
        dataset_differences = numpy.zeros((amount_clusters, len(self.__pointer_data)))
        for index_center in range(amount_clusters):
            if self.__metric.get_type() != type_metric.USER_DEFINED:
                dataset_differences[index_center] = self.__metric(self.__pointer_data, self.__centers[index_center])
            else:
                dataset_differences[index_center] = [ self.__metric(point, self.__centers[index_center])
                                                      for point in self.__pointer_data ]

        return dataset_differences
def __calculate_dataset_difference(self, amount_clusters):
        """!
        @brief Calculate distance from each point to each cluster center.

        """
        dataset_differences = numpy.zeros((amount_clusters, len(self.__pointer_data)))
        for index_center in range(amount_clusters):
            if self.__metric.get_type() != type_metric.USER_DEFINED:
                dataset_differences[index_center] = self.__metric(self.__pointer_data, self.__centers[index_center])
            else:
                dataset_differences[index_center] = [ self.__metric(point, self.__centers[index_center])
                                                      for point in self.__pointer_data ]

        return dataset_differences
def __calculate_dataset_difference ( self , amount_clusters ) : dataset_differences = numpy . zeros ( ( amount_clusters , len ( self . __pointer_data ) ) ) for index_center in range ( amount_clusters ) : if self . __metric . get_type ( ) != type_metric . USER_DEFINED : dataset_differences [ index_center ] = self . __metric ( self . __pointer_data , self . __centers [ index_center ] ) else : dataset_differences [ index_center ] = [ self . __metric ( point , self . __centers [ index_center ] ) for point in self . __pointer_data ] return dataset_differences
!
        @brief Calculate distance from each point to each cluster center.
!