(self)
打印聚类结果
打印聚类结果
打印聚类结果
def printResult(self):
        '''
        打印聚类结果
        '''
        print('-'*80)
        print('*'*80)
        print('-'*80)
        print('*'*30, '聚类结果', '*'*30)
        print('-'*30,'各簇中心','-'*30)
        for i in range(self.K):
            print('第', str(i), '簇中心：', self.centroid[i])
        print('-'*80)
        print('-'*30,'各簇结果','-'*30)
        for i in range(self.K):
            print('-'*20, '第', str(i), '簇结果', '-'*20,)
            for d in self.clusters[i]:
                print(d[5])

        print('-'*80)
        print('*'*80)
        print('-'*80)
def printResult ( self ) : print ( '-' * 80 ) print ( '*' * 80 ) print ( '-' * 80 ) print ( '*' * 30 , '聚类结果', '*'*30 ) print ( '-' * 30 , '各簇中心','-'*30) for i in range ( self . K ) : print ( '第',  s r(i ) , ' 中心：', self.cen t oid[ i ]) print ( '-' * 80 ) print ( '-' * 30 , '各簇结果','-'*30) for i in range ( self . K ) : print ( '-' * 20 , '第',  s r(i ) , ' 结果', '-'*20 , for d in self . clusters [ i ] : print ( d [ 5 ] ) print ( '-' * 80 ) print ( '*' * 80 ) print ( '-' * 80 )