コード例 #1
0
ファイル: kmedoids.py プロジェクト: terry07/pyclustering
 def __update_medoids(self):
     """!
     @brief Find medoids of clusters in line with contained objects.
     
     @return (list) list of medians for current number of clusters.
     
     """
      
     medians = [[] for i in range(len(self.__clusters))];
     
     for index in range(len(self.__clusters)):
         meadian_index = median(self.__pointer_data, self.__clusters[index]);
         medians[index] = self.__pointer_data[meadian_index];
          
     return medians;
コード例 #2
0
ファイル: kmedoids.py プロジェクト: genana/MPI_OPTICS
    def __update_medoids(self):
        """!
        @brief Find medoids of clusters in line with contained objects.
        
        @return (list) list of medoids for current number of clusters.
        
        """

        medoids = [[] for i in range(len(self.__clusters))]

        for index in range(len(self.__clusters)):
            medoid_index = median(self.__pointer_data, self.__clusters[index])
            medoids[index] = self.__pointer_data[medoid_index]

        return medoids
コード例 #3
0
ファイル: kmedoids.py プロジェクト: zgsxwsdxg/pyclustering
    def __update_medoids(self):
        """!
        @brief Find medoids of clusters in line with contained objects.
        
        @return (list) list of medoids for current number of clusters.
        
        """

        medoid_indexes = [-1] * len(self.__clusters)
        
        for index in range(len(self.__clusters)):
            medoid_index = median(self.__pointer_data, self.__clusters[index], metric=self.__metric, data_type=self.__data_type)
            medoid_indexes[index] = medoid_index
             
        return medoid_indexes